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> 15// tuple(allocator_arg_t, const Alloc& a, tuple&&); 16 17// UNSUPPORTED: c++98, c++03 18 19#include <tuple> 20#include <cassert> 21 22#include "MoveOnly.h" 23#include "allocators.h" 24#include "../alloc_first.h" 25#include "../alloc_last.h" 26 27int main() 28{ 29 { 30 typedef std::tuple<> T; 31 T t0; 32 T t(std::allocator_arg, A1<int>(), std::move(t0)); 33 } 34 { 35 typedef std::tuple<MoveOnly> T; 36 T t0(MoveOnly(0)); 37 T t(std::allocator_arg, A1<int>(), std::move(t0)); 38 assert(std::get<0>(t) == 0); 39 } 40 { 41 typedef std::tuple<alloc_first> T; 42 T t0(1); 43 alloc_first::allocator_constructed = false; 44 T t(std::allocator_arg, A1<int>(5), std::move(t0)); 45 assert(alloc_first::allocator_constructed); 46 assert(std::get<0>(t) == 1); 47 } 48 { 49 typedef std::tuple<alloc_last> T; 50 T t0(1); 51 alloc_last::allocator_constructed = false; 52 T t(std::allocator_arg, A1<int>(5), std::move(t0)); 53 assert(alloc_last::allocator_constructed); 54 assert(std::get<0>(t) == 1); 55 } 56 { 57 typedef std::tuple<MoveOnly, alloc_first> T; 58 T t0(0 ,1); 59 alloc_first::allocator_constructed = false; 60 T t(std::allocator_arg, A1<int>(5), std::move(t0)); 61 assert(alloc_first::allocator_constructed); 62 assert(std::get<0>(t) == 0); 63 assert(std::get<1>(t) == 1); 64 } 65 { 66 typedef std::tuple<MoveOnly, alloc_first, alloc_last> T; 67 T t0(1, 2, 3); 68 alloc_first::allocator_constructed = false; 69 alloc_last::allocator_constructed = false; 70 T t(std::allocator_arg, A1<int>(5), std::move(t0)); 71 assert(alloc_first::allocator_constructed); 72 assert(alloc_last::allocator_constructed); 73 assert(std::get<0>(t) == 1); 74 assert(std::get<1>(t) == 2); 75 assert(std::get<2>(t) == 3); 76 } 77} 78