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 <size_t I, class... Types> 15 // typename tuple_element<I, tuple<Types...> >::type const& 16 // get(const tuple<Types...>& t); 17 18 // UNSUPPORTED: c++98, c++03 19 20 #include <tuple> 21 #include <string> 22 #include <cassert> 23 main()24int main() 25 { 26 { 27 typedef std::tuple<double&, std::string, int> T; 28 double d = 1.5; 29 const T t(d, "high", 5); 30 assert(std::get<0>(t) == 1.5); 31 assert(std::get<1>(t) == "high"); 32 assert(std::get<2>(t) == 5); 33 std::get<0>(t) = 2.5; 34 assert(std::get<0>(t) == 2.5); 35 assert(std::get<1>(t) == "high"); 36 assert(std::get<2>(t) == 5); 37 assert(d == 2.5); 38 39 std::get<1>(t) = "four"; 40 } 41 } 42