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#include <tuple> 17#include <utility> 18#include <cassert> 19 20int main() 21{ 22 { 23 typedef std::pair<double, char> T0; 24 typedef std::tuple<int, short> T1; 25 T0 t0(2.5, 'a'); 26 T1 t1 = t0; 27 assert(std::get<0>(t1) == 2); 28 assert(std::get<1>(t1) == short('a')); 29 } 30#if _LIBCPP_STD_VER > 11 31 { 32 typedef std::pair<double, char> P0; 33 typedef std::tuple<int, short> T1; 34 constexpr P0 p0(2.5, 'a'); 35 constexpr T1 t1 = p0; 36 static_assert(std::get<0>(t1) != std::get<0>(p0), ""); 37 static_assert(std::get<1>(t1) == std::get<1>(p0), ""); 38 static_assert(std::get<0>(t1) == 2, ""); 39 static_assert(std::get<1>(t1) == short('a'), ""); 40 } 41#endif 42} 43