43 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// <tuple>10 11// template <class... Types> class tuple;12 13// template <size_t I, class... Types>14// typename tuple_element<I, tuple<Types...> >::type const&15// get(const tuple<Types...>& t);16 17// UNSUPPORTED: c++0318 19#include <tuple>20#include <string>21#include <cassert>22 23int main(int, char**)24{25 {26 typedef std::tuple<double&, std::string, int> T;27 double d = 1.5;28 const T t(d, "high", 5);29 assert(std::get<0>(t) == 1.5);30 assert(std::get<1>(t) == "high");31 assert(std::get<2>(t) == 5);32 std::get<0>(t) = 2.5;33 assert(std::get<0>(t) == 2.5);34 assert(std::get<1>(t) == "high");35 assert(std::get<2>(t) == 5);36 assert(d == 2.5);37 38 std::get<1>(t) = "four";39 }40 41 return 0;42}43