From 373c00952c0a3cb0224f2259487f6481c3c946e9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Dumont?= Date: Tue, 7 Jun 2016 20:19:19 +0000 Subject: [PATCH] tuple (_Head_base<>): Default specialization condition at type declaration. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2016-06-07 François Dumont * include/std/tuple (_Head_base<>): Default specialization condition at type declaration. From-SVN: r237184 --- libstdc++-v3/ChangeLog | 5 ++++ libstdc++-v3/include/std/tuple | 43 +++++++++++++++++----------------- 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 + + * include/std/tuple (_Head_base<>): Default specialization condition at + type declaration. + 2016-06-06 Ville Voutilainen 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 + template + class tuple; + + template + struct __is_empty_non_tuple : is_empty<_Tp> { }; + + // Using EBO for elements that are tuples causes ambiguous base errors. + template + struct __is_empty_non_tuple> : false_type { }; + + // Use the Empty Base-class Optimization for empty, non-final types. + template + using __empty_not_final + = typename conditional<__is_final(_Tp), false_type, + __is_empty_non_tuple<_Tp>>::type; + + template::value> struct _Head_base; template @@ -158,19 +175,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct _Tuple_impl; - template - struct __is_empty_non_tuple : is_empty<_Tp> { }; - - // Using EBO for elements that are tuples causes ambiguous base errors. - template - struct __is_empty_non_tuple> : false_type { }; - - // Use the Empty Base-class Optimization for empty, non-final types. - template - 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 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 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 struct _Tuple_impl<_Idx, _Head> - : private _Head_base<_Idx, _Head, __empty_not_final<_Head>::value> + : private _Head_base<_Idx, _Head> { template 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 - class tuple; - // Concept utility functions, reused in conditionally-explicit // constructors. template -- 2.30.2