summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Dumont <fdumont@gcc.gnu.org>2016-06-07 20:19:19 +0000
committerFrançois Dumont <fdumont@gcc.gnu.org>2016-06-07 20:19:19 +0000
commit373c00952c0a3cb0224f2259487f6481c3c946e9 (patch)
tree1c58ccb63cf4ac17262b117b30da13e18a19ee3d
parenta23e6f1c59191c2c455650f04053c9c760fd07a5 (diff)
downloadgcc-373c00952c0a3cb0224f2259487f6481c3c946e9.tar.gz
tuple (_Head_base<>): Default specialization condition at type declaration.
2016-06-07 François Dumont <fdumont@gcc.gnu.org> * include/std/tuple (_Head_base<>): Default specialization condition at type declaration. From-SVN: r237184
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/std/tuple43
2 files changed, 27 insertions, 21 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f550c35eb15..7166f394891 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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.
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index e64f6bfc5f5..6c124048df1 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -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>