libstdc++: Move ranges algos used by <ranges> into ranges_util.h
authorPatrick Palka <ppalka@redhat.com>
Fri, 18 Jun 2021 02:44:41 +0000 (22:44 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 18 Jun 2021 02:44:41 +0000 (22:44 -0400)
commit2786064d91f46cbdb35a543a883155a3982b9478
treed67a15dab09a4ffb0bb7e90f72883952c4eca324
parent4b4f5666b4c2f3aab2a9f3d53d394e390b9b682d
libstdc++: Move ranges algos used by <ranges> into ranges_util.h

The <ranges> header defines simplified copies of some ranges algorithms
in order to avoid including the entirety of ranges_algo.h.  A subsequent
patch is going to want to use ranges::search in <ranges> as well, and
that algorithm is more complicated compared to the other copied ones.

So rather than additionally copying ranges::search into <ranges>, this
patch splits out all the ranges algos used by <ranges> (including
ranges::search) from ranges_algo.h to ranges_util.h, and deletes the
simplified copies in <ranges>.  This seems like the best place to
put these algorithms, as ranges_util.h is currently included only from
<ranges> and ranges_algo.h.

libstdc++-v3/ChangeLog:

* include/bits/ranges_algo.h (__find_fn, find, __find_if_fn)
(find_if, __find_if_not_fn, find_if_not, _in_in_result)
(__mismatch_fn, mismatch, __search_fn, search): Move to ...
* include/bits/ranges_util.h: ... here.
* include/std/ranges (__detail::find, __detail::find_if)
(__detail::find_if_not, __detail::mismatch): Remove.
(filter_view): Use ranges::find_if instead.
(drop_while_view): Use ranges::find_if_not instead.
(split_view): Use ranges::find and ranges::mismatch instead.
libstdc++-v3/include/bits/ranges_algo.h
libstdc++-v3/include/bits/ranges_util.h
libstdc++-v3/include/std/ranges