Partially revert move of std::tuple_element_t to <tuple>
authorJonathan Wakely <jwakely@redhat.com>
Thu, 14 Jun 2018 19:02:40 +0000 (20:02 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 14 Jun 2018 19:02:40 +0000 (20:02 +0100)
Defining std::tuple_element_t in <utility> makes it available wherever
std::tuple_element is available.

* include/std/tuple (__cpp_lib_tuple_element_t, tuple_element_t):
Move back to <utility>.
* include/std/utility (__cpp_lib_tuple_element_t. tuple_element_t):
Restore to here.

From-SVN: r261604

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/tuple
libstdc++-v3/include/std/utility

index 94541d1a68dcad84319745536b85d815dacc91bf..2bfda083ee3eb517a04170ba00e3047b5de7f328 100644 (file)
@@ -1,5 +1,10 @@
 2018-06-14  Jonathan Wakely  <jwakely@redhat.com>
 
+       * include/std/tuple (__cpp_lib_tuple_element_t, tuple_element_t):
+       Move back to <utility>.
+       * include/std/utility (__cpp_lib_tuple_element_t. tuple_element_t):
+       Restore to here.
+
        P0935R0 Eradicating unnecessarily explicit default constructors
        * include/backward/strstream (strstreambuf): Add non-explicit default
        constructor.
index 0f890504889ca076e41848b95a50ba760a68aa83..dd7daf7f1cf48a3dac7c687b5430507ddcd3802a 100644 (file)
@@ -1298,13 +1298,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          "tuple index is in range");
     };
 
-#if __cplusplus >= 201402L
-#define __cpp_lib_tuple_element_t 201402L
-
-  template<size_t __i, typename _Tp>
-    using tuple_element_t = typename tuple_element<__i, _Tp>::type;
-#endif
-
   template<std::size_t __i, typename _Head, typename... _Tail>
     constexpr _Head&
     __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
index 7bf80de37459034d02137b854da2cf5f7bcd3de9..17e7d4cbe7a916c5e506659af2b9e0170eea033e 100644 (file)
@@ -135,6 +135,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       typedef typename add_cv<__tuple_element_t<__i, _Tp>>::type type;
     };
 
+#if __cplusplus >= 201402L
+// The standard says this macro and alias template should be in <tuple>
+// but we define them here, to be available when the partial specializations
+// of tuple_element<pair<T,U>> and tuple_element<array<T,N>> are defined.
+#define __cpp_lib_tuple_element_t 201402L
+
+  template<std::size_t __i, typename _Tp>
+    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