On 29/03/21 14:49 -0400, Patrick Palka via Libstdc++ wrote:
The <ranges> header currently copies some simple algorithms from
<bits/ranges_algo.h>, which was originally done in order to avoid a
circular dependency with the header. This is no longer an issue since
the latter header now includes <bits/ranges_util.h> instead of all of
<ranges>.
This means we could now just include <bits/ranges_algo.h> and remove the
copied algorithms, but that would double the size of <ranges>. And we
can't use the corresponding STL-style algorithms here because they
assume input iterators are copyable. So this patch instead simplifies
these copied algorithms, removing their constraints and unused
parameters, and keeps them around. In a subsequent patch we're going to
copy ranges::find into <ranges> as well.
libstdc++-v3/ChangeLog:
* include/std/ranges (__detail::find_if): Simplify.
(__detail::find_if_not): Likewise.
(__detail::min): Remove.
(__detail::mismatch): Simplify.
(take_view::size): Use std::min instead of __detail::min.
I wonder if we want a <bits/ranges_algobase.h> which has this subset
of algos. That could be used from <ranges> and also from the real
algos in <bits/ranges_algo.h>. The ones in ranges_algobase.h wouldn't
need to have the constraints (because we know the caller is
constrained, or uses them correctly), but for that to work the unused
params would need to be re-added. We can consider that for GCC 12
though.
So OK for GCC 11.