1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <tuple> 10 11 // template <class... Types> class tuple; 12 13 // template <class Alloc, class U1, class U2> 14 // tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&); 15 16 // UNSUPPORTED: c++98, c++03 17 18 #include <tuple> 19 #include <utility> 20 #include <cassert> 21 22 #include "allocators.h" 23 #include "../alloc_first.h" 24 #include "../alloc_last.h" 25 26 int main(int, char**) 27 { 28 { 29 typedef std::pair<long, int> T0; 30 typedef std::tuple<long long, double> T1; 31 T0 t0(2, 3); 32 T1 t1(std::allocator_arg, A1<int>(5), t0); 33 assert(std::get<0>(t1) == 2); 34 assert(std::get<1>(t1) == 3); 35 } 36 { 37 typedef std::pair<int, int> T0; 38 typedef std::tuple<alloc_first, double> T1; 39 T0 t0(2, 3); 40 alloc_first::allocator_constructed = false; 41 T1 t1(std::allocator_arg, A1<int>(5), t0); 42 assert(alloc_first::allocator_constructed); 43 assert(std::get<0>(t1) == 2); 44 assert(std::get<1>(t1) == 3); 45 } 46 { 47 typedef std::pair<int, int> T0; 48 typedef std::tuple<alloc_first, alloc_last> T1; 49 T0 t0(2, 3); 50 alloc_first::allocator_constructed = false; 51 alloc_last::allocator_constructed = false; 52 T1 t1(std::allocator_arg, A1<int>(5), t0); 53 assert(alloc_first::allocator_constructed); 54 assert(alloc_last::allocator_constructed); 55 assert(std::get<0>(t1) == 2); 56 assert(std::get<1>(t1) == 3); 57 } 58 59 return 0; 60 } 61