Message ID | 20200228163459.1815748-1-ppalka@redhat.com |
---|---|
State | New |
Headers | show |
Series | libstdc++: Also disable caching of reverse_view::begin() for common_ranges | expand |
On 28/02/20 11:34 -0500, Patrick Palka wrote: >When the underlying range models common_range, then reverse_view::begin() is >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. OK, thanks.
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;