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... UTypes>
15 // tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&);
16
17 #include <tuple>
18 #include <cassert>
19
20 #include "allocators.h"
21 #include "../alloc_first.h"
22 #include "../alloc_last.h"
23
main()24 int main()
25 {
26 {
27 typedef std::tuple<double> T0;
28 typedef std::tuple<int> T1;
29 T0 t0(2.5);
30 T1 t1(std::allocator_arg, A1<int>(), t0);
31 assert(std::get<0>(t1) == 2);
32 }
33 {
34 typedef std::tuple<int> T0;
35 typedef std::tuple<alloc_first> T1;
36 T0 t0(2);
37 alloc_first::allocator_constructed = false;
38 T1 t1(std::allocator_arg, A1<int>(5), t0);
39 assert(alloc_first::allocator_constructed);
40 assert(std::get<0>(t1) == 2);
41 }
42 {
43 typedef std::tuple<int, int> T0;
44 typedef std::tuple<alloc_first, alloc_last> T1;
45 T0 t0(2, 3);
46 alloc_first::allocator_constructed = false;
47 alloc_last::allocator_constructed = false;
48 T1 t1(std::allocator_arg, A1<int>(5), t0);
49 assert(alloc_first::allocator_constructed);
50 assert(alloc_last::allocator_constructed);
51 assert(std::get<0>(t1) == 2);
52 assert(std::get<1>(t1) == 3);
53 }
54 {
55 typedef std::tuple<double, int, int> T0;
56 typedef std::tuple<int, alloc_first, alloc_last> T1;
57 T0 t0(1.5, 2, 3);
58 alloc_first::allocator_constructed = false;
59 alloc_last::allocator_constructed = false;
60 T1 t1(std::allocator_arg, A1<int>(5), t0);
61 assert(alloc_first::allocator_constructed);
62 assert(alloc_last::allocator_constructed);
63 assert(std::get<0>(t1) == 1);
64 assert(std::get<1>(t1) == 2);
65 assert(std::get<2>(t1) == 3);
66 }
67 }
68