]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tuple (_Head_base<>): Default specialization condition at type declaration.
authorFrançois Dumont <fdumont@gcc.gnu.org>
Tue, 7 Jun 2016 20:19:19 +0000 (20:19 +0000)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Tue, 7 Jun 2016 20:19:19 +0000 (20:19 +0000)
2016-06-07  François Dumont  <fdumont@gcc.gnu.org>

* include/std/tuple (_Head_base<>): Default specialization condition at
type declaration.

From-SVN: r237184

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

index f550c35eb15fd50ea04c83820b3ddd5d9b22ffe2..7166f39489120cc7cdae67bb30ea46e7fb577c6d 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-07  François Dumont  <fdumont@gcc.gnu.org>
+
+       * include/std/tuple (_Head_base<>): Default specialization condition at
+       type declaration.
+
 2016-06-06  Ville Voutilainen  <ville.voutilainen@gmail.com>
 
        Support allocators in tuples of zero size.
index e64f6bfc5f571776d8a57fc6da3138951234ff62..6c124048df101ff2dae8e15a6fc7b051732b7fbc 100644 (file)
@@ -48,7 +48,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  @{
    */
 
-  template<std::size_t _Idx, typename _Head, bool _IsEmptyNotFinal>
+  template<typename... _Elements>
+    class tuple;
+
+  template<typename _Tp>
+    struct __is_empty_non_tuple : is_empty<_Tp> { };
+
+  // Using EBO for elements that are tuples causes ambiguous base errors.
+  template<typename _El0, typename... _El>
+    struct __is_empty_non_tuple<tuple<_El0, _El...>> : false_type { };
+
+  // Use the Empty Base-class Optimization for empty, non-final types.
+  template<typename _Tp>
+    using __empty_not_final
+    = typename conditional<__is_final(_Tp), false_type,
+                          __is_empty_non_tuple<_Tp>>::type;
+
+  template<std::size_t _Idx, typename _Head,
+          bool = __empty_not_final<_Head>::value>
     struct _Head_base;
 
   template<std::size_t _Idx, typename _Head>
@@ -158,19 +175,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<std::size_t _Idx, typename... _Elements>
     struct _Tuple_impl; 
 
-  template<typename _Tp>
-    struct __is_empty_non_tuple : is_empty<_Tp> { };
-
-  // Using EBO for elements that are tuples causes ambiguous base errors.
-  template<typename _El0, typename... _El>
-    struct __is_empty_non_tuple<tuple<_El0, _El...>> : false_type { };
-
-  // Use the Empty Base-class Optimization for empty, non-final types.
-  template<typename _Tp>
-    using __empty_not_final
-    = typename conditional<__is_final(_Tp), false_type,
-                          __is_empty_non_tuple<_Tp>>::type;
-
   /**
    * Recursive tuple implementation. Here we store the @c Head element
    * and derive from a @c Tuple_impl containing the remaining elements
@@ -179,12 +183,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<std::size_t _Idx, typename _Head, typename... _Tail>
     struct _Tuple_impl<_Idx, _Head, _Tail...>
     : public _Tuple_impl<_Idx + 1, _Tail...>,
-      private _Head_base<_Idx, _Head, __empty_not_final<_Head>::value>
+      private _Head_base<_Idx, _Head>
     {
       template<std::size_t, typename...> friend class _Tuple_impl;
 
       typedef _Tuple_impl<_Idx + 1, _Tail...> _Inherited;
-      typedef _Head_base<_Idx, _Head, __empty_not_final<_Head>::value> _Base;
+      typedef _Head_base<_Idx, _Head> _Base;
 
       static constexpr _Head&  
       _M_head(_Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
@@ -336,11 +340,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // Basis case of inheritance recursion.
   template<std::size_t _Idx, typename _Head>
     struct _Tuple_impl<_Idx, _Head>
-    : private _Head_base<_Idx, _Head, __empty_not_final<_Head>::value>
+    : private _Head_base<_Idx, _Head>
     {
       template<std::size_t, typename...> friend class _Tuple_impl;
 
-      typedef _Head_base<_Idx, _Head, __empty_not_final<_Head>::value> _Base;
+      typedef _Head_base<_Idx, _Head> _Base;
 
       static constexpr _Head&
       _M_head(_Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
@@ -457,9 +461,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       }
     };
 
-  template<typename... _Elements>
-    class tuple;
-
   // Concept utility functions, reused in conditionally-explicit
   // constructors.
   template<bool, typename... _Elements>