//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // template class tuple; // template // const typename tuple_element >::type&& // get(const tuple&& t); // UNSUPPORTED: c++03 #include #include #include #include #include #include "test_macros.h" int main(int, char**) { { typedef std::tuple T; const T t(3); static_assert(std::is_same(std::move(t)))>::value, ""); static_assert(noexcept(std::get<0>(std::move(t))), ""); const int&& i = std::get<0>(std::move(t)); assert(i == 3); } { typedef std::tuple T; const T t("high", 5); static_assert(std::is_same(std::move(t)))>::value, ""); static_assert(noexcept(std::get<0>(std::move(t))), ""); static_assert(std::is_same(std::move(t)))>::value, ""); static_assert(noexcept(std::get<1>(std::move(t))), ""); const std::string&& s = std::get<0>(std::move(t)); const int&& i = std::get<1>(std::move(t)); assert(s == "high"); assert(i == 5); } { int x = 42; int const y = 43; std::tuple const p(x, y); static_assert(std::is_same(std::move(p)))>::value, ""); static_assert(noexcept(std::get<0>(std::move(p))), ""); static_assert(std::is_same(std::move(p)))>::value, ""); static_assert(noexcept(std::get<1>(std::move(p))), ""); } { int x = 42; int const y = 43; std::tuple const p(std::move(x), std::move(y)); static_assert(std::is_same(std::move(p)))>::value, ""); static_assert(noexcept(std::get<0>(std::move(p))), ""); static_assert(std::is_same(std::move(p)))>::value, ""); static_assert(noexcept(std::get<1>(std::move(p))), ""); } #if TEST_STD_VER > 11 { typedef std::tuple T; constexpr const T t(2.718, 5); static_assert(std::get<0>(std::move(t)) == 2.718, ""); static_assert(std::get<1>(std::move(t)) == 5, ""); } #endif return 0; }