Re: [PATCH] libstdc++: Memoize {drop,drop_while,filter,reverse}_view::begin

2020-02-28 Thread Jonathan Wakely
On 27/02/20 14:26 -0500, Patrick Palka wrote: On Wed, 26 Feb 2020, Patrick Palka wrote: On Tue, 11 Feb 2020, Patrick Palka wrote: > This patch adds memoization for these four views so that their begin() has the > required constant time amortized complexity. > > In the general case we use

Re: [PATCH] libstdc++: Memoize {drop,drop_while,filter,reverse}_view::begin

2020-02-27 Thread Patrick Palka
or instead of having to use std::optional or needing an external flag denoting the empty state of the cache, which is both optimal space-wise and constexpr safe! -- >8 -- Subject: [PATCH] libstdc++: Memoize {drop,drop_while,filter,reverse}_view::begin This patch adds memoization to these four views so

Re: [PATCH] libstdc++: Memoize {drop,drop_while,filter,reverse}_view::begin

2020-02-26 Thread Patrick Palka
Here's v2 of this patch which uses the new helper __detail::__maybe_empty_t and provides a more descriptive commit message. It also refines the constraints on the partial specializations of _CachedPosition. -- >8 -- Subject: [PATCH] libstdc++: Memoize {drop,drop_while,filter,reverse}_view::begi

[PATCH] libstdc++: Memoize {drop,drop_while,filter,reverse}_view::begin

2020-02-11 Thread Patrick Palka
This patch adds memoization for these four views so that their begin() has the required constant time amortized complexity. In the general case we use std::optional to cache the result. When the underlying range is a random_access_range then we store the cache as an offset from the beginning of