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 #include <tuple> 18 #include <utility> 19 #include <cassert> 20 21 #include "allocators.h" 22 #include "../alloc_first.h" 23 #include "../alloc_last.h" 24 25 int main() 26 { 27 { 28 typedef std::pair<double, int> T0; 29 typedef std::tuple<int, double> T1; 30 T0 t0(2, 3); 31 T1 t1(std::allocator_arg, A1<int>(5), t0); 32 assert(std::get<0>(t1) == 2); 33 assert(std::get<1>(t1) == 3); 34 } 35 { 36 typedef std::pair<int, int> T0; 37 typedef std::tuple<alloc_first, double> T1; 38 T0 t0(2, 3); 39 alloc_first::allocator_constructed = false; 40 T1 t1(std::allocator_arg, A1<int>(5), t0); 41 assert(alloc_first::allocator_constructed); 42 assert(std::get<0>(t1) == 2); 43 assert(std::get<1>(t1) == 3); 44 } 45 { 46 typedef std::pair<int, int> T0; 47 typedef std::tuple<alloc_first, alloc_last> T1; 48 T0 t0(2, 3); 49 alloc_first::allocator_constructed = false; 50 alloc_last::allocator_constructed = false; 51 T1 t1(std::allocator_arg, A1<int>(5), t0); 52 assert(alloc_first::allocator_constructed); 53 assert(alloc_last::allocator_constructed); 54 assert(std::get<0>(t1) == 2); 55 assert(std::get<1>(t1) == 3); 56 } 57 } 58