From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2136) id 832F63AA9C35; Wed, 17 Jun 2020 19:21:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 832F63AA9C35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592421714; bh=U5cpFnB6V+pSzaY9dVaSrmymKKheKQ10CyNwHqqBRdo=; h=From:To:Subject:Date:From; b=j23iGj8XxHX1DXJwmpMA6gLYp0oZEhgB81plRTKBbcOFe/iwS0R4E8VkKw7JCi66X wQgc5ItCJeqAsQKJE8yC2cXkwIv2V/5tVMiSSHT+kLTnIAeADQJ8GPLHsf7elg+sEv nxYfk3KCZRODOQNziarUNwJAytzqNL4R5gHyM2/s= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Aldy Hernandez To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc/devel/ranger] libstdc++: Rename __detail::__maybe_empty_t alias template X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/devel/ranger X-Git-Oldrev: 005530eb019eb7703534540bdac01e5acc611e78 X-Git-Newrev: 4c391563407aeba981f6a71423297f36d5ece0ee Message-Id: <20200617192154.832F63AA9C35@sourceware.org> Date: Wed, 17 Jun 2020 19:21:54 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2020 19:21:54 -0000 https://gcc.gnu.org/g:4c391563407aeba981f6a71423297f36d5ece0ee commit 4c391563407aeba981f6a71423297f36d5ece0ee Author: Jonathan Wakely Date: Mon Mar 2 17:03:28 2020 +0000 libstdc++: Rename __detail::__maybe_empty_t alias template The key property of this alias is not that it may be an empty type, but that the type argument may not be used. The fact it's replaced by an empty type is just an implementation detail. The name was also backwards with respect to the bool argument. This patch changes the name to better reflect its purpose. * include/std/ranges (__detail::__maybe_empty_t): Rename to __maybe_present_t. (__adaptor::_RangeAdaptor, join_view, split_view): Use new name. Diff: --- libstdc++-v3/ChangeLog | 4 ++++ libstdc++-v3/include/std/ranges | 35 +++++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 7a02492339d..d810b0887b5 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,9 @@ 2020-03-02 Jonathan Wakely + * include/std/ranges (__detail::__maybe_empty_t): Rename to + __maybe_present_t. + (__adaptor::_RangeAdaptor, join_view, split_view): Use new name. + * include/bits/ranges_algo.h (shift_right): Add 'typename' to dependent type. diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 19d3da950e7..c71cf918cfc 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -1030,9 +1030,14 @@ namespace __detail { struct _Empty { }; - template - using __maybe_empty_t = conditional_t<_NonEmpty, _Tp, _Empty>; - + // Alias for a type that is conditionally present + // (and is an empty type otherwise). + // Data members using this alias should use [[no_unique_address]] so that + // they take no space when not needed. + template + using __maybe_present_t = conditional_t<_Present, _Tp, _Empty>; + + // Alias for a type that is conditionally const. template using __maybe_const_t = conditional_t<_Const, const _Tp, _Tp>; @@ -1065,8 +1070,8 @@ namespace views { protected: [[no_unique_address]] - __detail::__maybe_empty_t, - _Callable> _M_callable; + __detail::__maybe_present_t, + _Callable> _M_callable; public: constexpr @@ -2211,8 +2216,9 @@ namespace views static constexpr bool _S_needs_cached_begin = !random_access_range<_Vp>; [[no_unique_address]] - __detail::__maybe_empty_t<_S_needs_cached_begin, - __detail::_CachedPosition<_Vp>> _M_cached_begin; + __detail::__maybe_present_t<_S_needs_cached_begin, + __detail::_CachedPosition<_Vp>> + _M_cached_begin; public: drop_view() = default; @@ -2592,8 +2598,8 @@ namespace views // XXX: _M_inner is "present only when !is_reference_v<_InnerRange>" [[no_unique_address]] - __detail::__maybe_empty_t, - views::all_t<_InnerRange>> _M_inner; + __detail::__maybe_present_t, + views::all_t<_InnerRange>> _M_inner; public: join_view() = default; @@ -2728,8 +2734,8 @@ namespace views // XXX: _M_current is present only if "V models forward_range" [[no_unique_address]] - __detail::__maybe_empty_t, - iterator_t<_Base>> _M_current; + __detail::__maybe_present_t, + iterator_t<_Base>> _M_current; public: using iterator_concept = conditional_t, @@ -2969,7 +2975,7 @@ namespace views // XXX: _M_current is "present only if !forward_range" [[no_unique_address]] - __detail::__maybe_empty_t, iterator_t<_Vp>> + __detail::__maybe_present_t, iterator_t<_Vp>> _M_current; @@ -3180,8 +3186,9 @@ namespace views static constexpr bool _S_needs_cached_begin = !common_range<_Vp> && !random_access_range<_Vp>; [[no_unique_address]] - __detail::__maybe_empty_t<_S_needs_cached_begin, - __detail::_CachedPosition<_Vp>> _M_cached_begin; + __detail::__maybe_present_t<_S_needs_cached_begin, + __detail::_CachedPosition<_Vp>> + _M_cached_begin; public: reverse_view() = default;