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 // <tuple>
11 
12 // template <class... Types> class tuple;
13 
14 // template <class Alloc, class U1, class U2>
15 //   tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&);
16 
17 // UNSUPPORTED: c++98, c++03
18 
19 #include <tuple>
20 #include <utility>
21 #include <cassert>
22 
23 #include "allocators.h"
24 #include "../alloc_first.h"
25 #include "../alloc_last.h"
26 
main()27 int main()
28 {
29     {
30         typedef std::pair<double, int> T0;
31         typedef std::tuple<int, double> T1;
32         T0 t0(2, 3);
33         T1 t1(std::allocator_arg, A1<int>(5), t0);
34         assert(std::get<0>(t1) == 2);
35         assert(std::get<1>(t1) == 3);
36     }
37     {
38         typedef std::pair<int, int> T0;
39         typedef std::tuple<alloc_first, double> T1;
40         T0 t0(2, 3);
41         alloc_first::allocator_constructed = false;
42         T1 t1(std::allocator_arg, A1<int>(5), t0);
43         assert(alloc_first::allocator_constructed);
44         assert(std::get<0>(t1) == 2);
45         assert(std::get<1>(t1) == 3);
46     }
47     {
48         typedef std::pair<int, int> T0;
49         typedef std::tuple<alloc_first, alloc_last> T1;
50         T0 t0(2, 3);
51         alloc_first::allocator_constructed = false;
52         alloc_last::allocator_constructed = false;
53         T1 t1(std::allocator_arg, A1<int>(5), t0);
54         assert(alloc_first::allocator_constructed);
55         assert(alloc_last::allocator_constructed);
56         assert(std::get<0>(t1) == 2);
57         assert(std::get<1>(t1) == 3);
58     }
59 }
60