From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1984) id 4CE3739960F6; Fri, 17 Jul 2020 13:29:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CE3739960F6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594992555; bh=+4vpnTmJoDOuYcquVFJ1U5zg7E4vP1VWIXT/OLxS3Ro=; h=From:To:Subject:Date:From; b=NRLfFTBl2WXV6ydI+vbb7/rEBFNRg+9Pzwl4qHF8Yg45ykt/X0Y+cEnt7HNrHLS5E pA4tpav0DPBiyvdaQcf9bS6hdrlgusCnlbjjjtEi26V/fvZJpN/tkM2OQKqKjb2BE5 zZYw9qQ5ZnDNi8aWpXnK+ocdW1pP98GTV6Vab31I= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Tamar Christina To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/arm-perf-staging)] libstdc++: Also disable caching of reverse_view::begin() for common_ranges X-Act-Checkin: gcc X-Git-Author: Patrick Palka X-Git-Refname: refs/vendors/ARM/heads/arm-perf-staging X-Git-Oldrev: 08bf7bde9f2987b1c623d272cc71fc14a1622442 X-Git-Newrev: 77e596cf3c1b7bc11ba946394ed8d62a49157b49 Message-Id: <20200717132915.4CE3739960F6@sourceware.org> Date: Fri, 17 Jul 2020 13:29:15 +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: Fri, 17 Jul 2020 13:29:15 -0000 https://gcc.gnu.org/g:77e596cf3c1b7bc11ba946394ed8d62a49157b49 commit 77e596cf3c1b7bc11ba946394ed8d62a49157b49 Author: Patrick Palka Date: Fri Feb 28 10:47:26 2020 -0500 libstdc++: Also disable caching of reverse_view::begin() for common_ranges When the underlying range models common_range, then reverse_view::begin() is already O(1) without caching. So we should disable the cache in this case too. libstdc++-v3/ChangeLog: * include/std/ranges (reverse_view::_S_needs_cached_begin): Set to false whenever the underlying range models common_range. Diff: --- libstdc++-v3/ChangeLog | 3 +++ libstdc++-v3/include/std/ranges | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 89e1f5bf952..0feef87cce6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2020-02-28 Patrick Palka + * include/std/ranges (reverse_view::_S_needs_cached_begin): Set to false + whenever the underlying range models common_range. + * include/std/ranges (__detail::_CachedPosition): New struct. (views::filter_view::_S_needs_cached_begin): New member variable. (views::filter_view::_M_cached_begin): New member variable. diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 2f773130979..19d3da950e7 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -3177,7 +3177,8 @@ namespace views private: _Vp _M_base = _Vp(); - static constexpr bool _S_needs_cached_begin = !random_access_range<_Vp>; + 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;