From 74755c6afcf45be8723e30f08b6e38ec105a636a Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 14 Jun 2018 15:01:29 +0100 Subject: [PATCH] Define __cpp_lib_tuple_element_t in not * include/std/tuple (__cpp_lib_tuple_element_t): Move feature test macro from and change type to long. * include/std/utility (__cpp_lib_tuple_element_t): Remove. * testsuite/20_util/tuple/tuple_element_t.cc: Check for feature test macro. From-SVN: r261596 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/include/std/tuple | 10 +++++++++- libstdc++-v3/include/std/utility | 7 ------- .../testsuite/20_util/tuple/tuple_element_t.cc | 6 ++++++ 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 738b7acc8f2..5f612239bb8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,11 @@ 2018-06-14 Jonathan Wakely + * include/std/tuple (__cpp_lib_tuple_element_t): Move feature test + macro from and change type to long. + * include/std/utility (__cpp_lib_tuple_element_t): Remove. + * testsuite/20_util/tuple/tuple_element_t.cc: Check for feature test + macro. + P0935R0 Eradicating unnecessarily explicit default constructors * include/bits/random.h (uniform_real_distribution::param_type) (normal_distribution::param_type, lognormal_distribution::param_type) diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 16f69220abb..0f890504889 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -1298,6 +1298,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION "tuple index is in range"); }; +#if __cplusplus >= 201402L +#define __cpp_lib_tuple_element_t 201402L + + template + using tuple_element_t = typename tuple_element<__i, _Tp>::type; +#endif + template constexpr _Head& __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept @@ -1338,7 +1345,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return std::forward(std::get<__i>(__t)); } -#if __cplusplus > 201103L +#if __cplusplus >= 201402L #define __cpp_lib_tuples_by_type 201304 @@ -1470,6 +1477,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2275. Why is forward_as_tuple not constexpr? + /// std::forward_as_tuple template constexpr tuple<_Elements&&...> forward_as_tuple(_Elements&&... __args) noexcept diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index c9695006ff1..7bf80de3745 100644 --- a/libstdc++-v3/include/std/utility +++ b/libstdc++-v3/include/std/utility @@ -135,13 +135,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typename add_cv<__tuple_element_t<__i, _Tp>>::type type; }; -#if __cplusplus > 201103L -#define __cpp_lib_tuple_element_t 201402 - - template - using tuple_element_t = typename tuple_element<__i, _Tp>::type; -#endif - // Various functions which give std::pair a tuple-like interface. /// Partial specialization for std::pair diff --git a/libstdc++-v3/testsuite/20_util/tuple/tuple_element_t.cc b/libstdc++-v3/testsuite/20_util/tuple/tuple_element_t.cc index 8f7aa58d34e..6b1b7a54251 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/tuple_element_t.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/tuple_element_t.cc @@ -19,6 +19,12 @@ #include +#ifndef __cpp_lib_tuple_element_t +# error "Feature-test macro for tuple_element_t missing" +#elif __cpp_lib_tuple_element_t != 201402 +# error "Feature-test macro for tuple_element_t has wrong value" +#endif + using namespace std; struct foo -- 2.30.2