xref: /aosp_15_r20/external/libcxx/test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp (revision 58b9f456b02922dfdb1fad8a988d5fd8765ecb80)
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // UNSUPPORTED: c++98, c++03
11 
12 // <utility>
13 
14 // template <class T1, class T2> struct pair
15 
16 // template <class... Args1, class... Args2>
17 //     pair(piecewise_construct_t, tuple<Args1...> first_args,
18 //                                 tuple<Args2...> second_args);
19 
20 #include <cassert>
21 #include <tuple>
22 #include <utility>
23 
24 
main()25 int main()
26 {
27     {
28         typedef std::pair<int, int*> P1;
29         typedef std::pair<int*, int> P2;
30         typedef std::pair<P1, P2> P3;
31         P3 p3(std::piecewise_construct, std::tuple<int, int*>(3, nullptr),
32                                         std::tuple<int*, int>(nullptr, 4));
33         assert(p3.first == P1(3, nullptr));
34         assert(p3.second == P2(nullptr, 4));
35     }
36 }
37