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... Types> 15 // tuple<Types&...> tie(Types&... t); 16 17 // UNSUPPORTED: c++98, c++03 18 19 #include <tuple> 20 #include <string> 21 #include <cassert> 22 main()23int main() 24 { 25 { 26 int i = 0; 27 std::string s; 28 std::tie(i, std::ignore, s) = std::make_tuple(42, 3.14, "C++"); 29 assert(i == 42); 30 assert(s == "C++"); 31 } 32 #if _LIBCPP_STD_VER > 11 33 { 34 static constexpr int i = 42; 35 static constexpr double f = 1.1; 36 constexpr std::tuple<const int &, const double &> t = std::tie(i, f); 37 static_assert ( std::get<0>(t) == 42, "" ); 38 static_assert ( std::get<1>(t) == 1.1, "" ); 39 } 40 #endif 41 } 42