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 U1, class U2> tuple(const pair<U1, U2>& u); 15 16 // UNSUPPORTED: c++98, c++03 17 18 #include <tuple> 19 #include <utility> 20 #include <cassert> 21 22 #include "test_macros.h" 23 24 int main() 25 { 26 { 27 typedef std::pair<double, char> T0; 28 typedef std::tuple<int, short> T1; 29 T0 t0(2.5, 'a'); 30 T1 t1 = t0; 31 assert(std::get<0>(t1) == 2); 32 assert(std::get<1>(t1) == short('a')); 33 } 34 #if TEST_STD_VER > 11 35 { 36 typedef std::pair<double, char> P0; 37 typedef std::tuple<int, short> T1; 38 constexpr P0 p0(2.5, 'a'); 39 constexpr T1 t1 = p0; 40 static_assert(std::get<0>(t1) != std::get<0>(p0), ""); 41 static_assert(std::get<1>(t1) == std::get<1>(p0), ""); 42 static_assert(std::get<0>(t1) == 2, ""); 43 static_assert(std::get<1>(t1) == short('a'), ""); 44 } 45 #endif 46 } 47