array: Include <array>.
authorFrançois Dumont <fdumont@gcc.gnu.org>
Tue, 23 Jun 2015 19:51:02 +0000 (19:51 +0000)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Tue, 23 Jun 2015 19:51:02 +0000 (19:51 +0000)
2015-06-23  François Dumont  <fdumont@gcc.gnu.org>

* include/debug/array: Include <array>. Add version namespace when
specializing tuple interface to array. Add specialization for
__is_tuple_like_impl.
* include/profile/array: Likewise.
* include/std/array: Include <utility>. Add specialization for
__is_tuple_like_impl.
* include/std/tuple
(__is_tuple_like_impl<>, __is_tuple_like_impl<pair>): Move...
* include/std/utility: ... here. Include <type_traits>.
* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Adjust
dg-error line number.
* testsuite/23_containers/array/tuple_interface/
tuple_element_debug_neg.cc: Likewise.

From-SVN: r224857

libstdc++-v3/ChangeLog
libstdc++-v3/include/debug/array
libstdc++-v3/include/profile/array
libstdc++-v3/include/std/array
libstdc++-v3/include/std/tuple
libstdc++-v3/include/std/utility
libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc
libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc

index 5aad2456912645e78c0074acbc9732a795eb09ae..ea6dc8833ebb8a1536e105d4abf4e1ef0cb140d5 100644 (file)
@@ -1,3 +1,19 @@
+2015-06-23  François Dumont  <fdumont@gcc.gnu.org>
+
+       * include/debug/array: Include <array>. Add version namespace when
+       specializing tuple interface to array. Add specialization for
+       __is_tuple_like_impl.
+       * include/profile/array: Likewise.
+       * include/std/array: Include <utility>. Add specialization for
+       __is_tuple_like_impl.
+       * include/std/tuple
+       (__is_tuple_like_impl<>, __is_tuple_like_impl<pair>): Move...
+       * include/std/utility: ... here. Include <type_traits>.
+       * testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Adjust
+       dg-error line number.
+       * testsuite/23_containers/array/tuple_interface/
+       tuple_element_debug_neg.cc: Likewise.
+
 2015-06-22  Jonathan Wakely  <jwakely@redhat.com>
 
        * testsuite/26_numerics/complex/value_operations/1.cc: Use
index 34e6281da5a5c5a342295d125830291af8d59664..a1c7d408beee73798ed9a9d1458994bb01806d4d 100644 (file)
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <array>
+
 #include <debug/formatter.h>
 #include <debug/macros.h>
 
@@ -292,20 +294,27 @@ namespace __debug
     }
 } // namespace __debug
 
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
   // Tuple interface to class template array.
 
   /// tuple_size
   template<typename _Tp, std::size_t _Nm>
-    struct tuple_size<__debug::array<_Tp, _Nm>>
+    struct tuple_size<std::__debug::array<_Tp, _Nm>>
     : public integral_constant<std::size_t, _Nm> { };
 
   /// tuple_element
   template<std::size_t _Int, typename _Tp, std::size_t _Nm>
-    struct tuple_element<_Int, __debug::array<_Tp, _Nm>>
+    struct tuple_element<_Int, std::__debug::array<_Tp, _Nm>>
     {
       static_assert(_Int < _Nm, "index is out of bounds");
       typedef _Tp type;
     };
+
+  template<typename _Tp, std::size_t _Nm>
+    struct __is_tuple_like_impl<std::__debug::array<_Tp, _Nm>> : true_type
+    { };
+
+_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
 #endif // _GLIBCXX_DEBUG_ARRAY
index 434ca968d8452a92a747d46733f5b0d687a25410..687c0525357473020ba07b49885563c8e99ef702 100644 (file)
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <array>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 namespace __profile
@@ -253,20 +255,27 @@ namespace __profile
     }
 } // namespace __profile
 
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
   // Tuple interface to class template array.
 
   /// tuple_size
   template<typename _Tp, std::size_t _Nm>
-    struct tuple_size<__profile::array<_Tp, _Nm>>
+    struct tuple_size<std::__profile::array<_Tp, _Nm>>
     : public integral_constant<std::size_t, _Nm> { };
 
   /// tuple_element
   template<std::size_t _Int, typename _Tp, std::size_t _Nm>
-    struct tuple_element<_Int, __profile::array<_Tp, _Nm>>
+    struct tuple_element<_Int, std::__profile::array<_Tp, _Nm>>
     {
       static_assert(_Int < _Nm, "index is out of bounds");
       typedef _Tp type;
     };
+
+  template<typename _Tp, std::size_t _Nm>
+    struct __is_tuple_like_impl<std::__profile::array<_Tp, _Nm>> : true_type
+    { };
+
+_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
 #endif // _GLIBCXX_PROFILE_ARRAY
index 40fbd46c5590b91b1c49a713f130b2abdf98ebe7..d1b5e6db3472186de5d639285b59bf374407e594 100644 (file)
@@ -35,6 +35,7 @@
 # include <bits/c++0x_warning.h>
 #else
 
+#include <utility>
 #include <stdexcept>
 #include <bits/stl_algobase.h>
 #include <bits/range_access.h>
@@ -331,6 +332,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       typedef _Tp type;
     };
 
+  template<typename _Tp, std::size_t _Nm>
+    struct __is_tuple_like_impl<_GLIBCXX_STD_C::array<_Tp, _Nm>> : true_type
+    { };
+
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
index 953d16b73b15af0700aeebd345d97ac71686d8e0..0504012cbd19a6107f143e849b3a1f331246a6af 100644 (file)
@@ -976,22 +976,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     forward_as_tuple(_Elements&&... __args) noexcept
     { return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); }
 
-  template<typename>
-    struct __is_tuple_like_impl : false_type
-    { };
-
   template<typename... _Tps>
     struct __is_tuple_like_impl<tuple<_Tps...>> : true_type
     { };
 
-  template<typename _T1, typename _T2>
-    struct __is_tuple_like_impl<pair<_T1, _T2>> : true_type
-    { };
-
-  template<typename _Tp, std::size_t _Nm>
-    struct __is_tuple_like_impl<_GLIBCXX_STD_C::array<_Tp, _Nm>> : true_type
-    { };
-
   // Internal type trait that allows us to sfinae-protect tuple_cat.
   template<typename _Tp>
     struct __is_tuple_like
index 1aac77c10cb4aced4f2fce5dae2cd7b3714a9709..89b68522ddf0b8399c328fe7da5948158f701bf9 100644 (file)
@@ -71,6 +71,7 @@
 
 #if __cplusplus >= 201103L
 
+#include <type_traits>
 #include <bits/move.h>
 #include <initializer_list>
 
@@ -84,7 +85,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<std::size_t _Int, class _Tp>
     class tuple_element;
 
-   // Various functions which give std::pair a tuple-like interface.
+  template<typename>
+    struct __is_tuple_like_impl : false_type
+    { };
+
+  // Various functions which give std::pair a tuple-like interface.
+
+  /// Partial specialization for std::pair
+  template<typename _T1, typename _T2>
+    struct __is_tuple_like_impl<std::pair<_T1, _T2>> : true_type
+    { };
 
   /// Partial specialization for std::pair
   template<class _Tp1, class _Tp2>
index 3e197fd3f310c221f2acd41d08b363bf587cc6fc..bc5c726b836887adcdcd81da22bf59a40a6f3266 100644 (file)
@@ -28,6 +28,6 @@ int n1 = std::get<1>(a);
 int n2 = std::get<1>(std::move(a));
 int n3 = std::get<1>(ca);
 
-// { dg-error "static assertion failed" "" { target *-*-* } 272 }
-// { dg-error "static assertion failed" "" { target *-*-* } 281 }
-// { dg-error "static assertion failed" "" { target *-*-* } 289 }
+// { dg-error "static assertion failed" "" { target *-*-* } 274 }
+// { dg-error "static assertion failed" "" { target *-*-* } 283 }
+// { dg-error "static assertion failed" "" { target *-*-* } 291 }
index b7472a23a521778dd08bc80fc01c481628ae931d..a27f3e238462d4ff2cef158958a266e9c3624d2e 100644 (file)
@@ -23,4 +23,4 @@
 
 typedef std::tuple_element<1, std::array<int, 1>>::type type;
 
-// { dg-error "static assertion failed" "" { target *-*-* } 306 }
+// { dg-error "static assertion failed" "" { target *-*-* } 309 }