diff options
author | Nikolas Klauser <nikolasklauser@berlin.de> | 2022-07-12 21:28:40 +0200 |
---|---|---|
committer | Nikolas Klauser <nikolasklauser@berlin.de> | 2022-07-13 13:11:26 +0200 |
commit | 76a76518507ccc59ccdad5b83f44dc8c3d9593c7 (patch) | |
tree | 944694fa9a21cca86677a5408ad1572a6bb772c5 /libcxx/include/algorithm | |
parent | 1d62fe9ce996b16a9d7e2a88ecfbbf9c9aed50af (diff) | |
download | llvm-76a76518507ccc59ccdad5b83f44dc8c3d9593c7.zip llvm-76a76518507ccc59ccdad5b83f44dc8c3d9593c7.tar.gz llvm-76a76518507ccc59ccdad5b83f44dc8c3d9593c7.tar.bz2 |
[libc++] Implement ranges::find_end, ranges::search{, _n}
Reviewed By: var-const, #libc, huixie90
Spies: h-vetinari, huixie90, libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D124079
Diffstat (limited to 'libcxx/include/algorithm')
-rw-r--r-- | libcxx/include/algorithm | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm index 387aebe..18d8ef3 100644 --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -649,6 +649,49 @@ namespace ranges { constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O> ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20 + template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, + sentinel_for<I2> S2, class Pred = ranges::equal_to, + class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> + constexpr subrange<I1> + ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<forward_range R1, forward_range R2, class Pred = ranges::equal_to, + class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> + constexpr borrowed_subrange_t<R1> + ranges::search(R1&& r1, R2&& r2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class T, + class Pred = ranges::equal_to, class Proj = identity> + requires indirectly_comparable<I, const T*, Pred, Proj> + constexpr subrange<I> + ranges::search_n(I first, S last, iter_difference_t<I> count, + const T& value, Pred pred = {}, Proj proj = {}); // since C++20 + + template<forward_range R, class T, class Pred = ranges::equal_to, + class Proj = identity> + requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj> + constexpr borrowed_subrange_t<R> + ranges::search_n(R&& r, range_difference_t<R> count, + const T& value, Pred pred = {}, Proj proj = {}); // since C++20 + + template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> + constexpr subrange<I1> + ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<forward_range R1, forward_range R2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> + constexpr borrowed_subrange_t<R1> + ranges::find_end(R1&& r1, R2&& r2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + } constexpr bool // constexpr in C++20 @@ -1392,6 +1435,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_fill.h> #include <__algorithm/ranges_fill_n.h> #include <__algorithm/ranges_find.h> +#include <__algorithm/ranges_find_end.h> #include <__algorithm/ranges_find_first_of.h> #include <__algorithm/ranges_find_if.h> #include <__algorithm/ranges_find_if_not.h> @@ -1424,6 +1468,8 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_reverse.h> #include <__algorithm/ranges_reverse_copy.h> #include <__algorithm/ranges_rotate_copy.h> +#include <__algorithm/ranges_search.h> +#include <__algorithm/ranges_search_n.h> #include <__algorithm/ranges_set_difference.h> #include <__algorithm/ranges_set_intersection.h> #include <__algorithm/ranges_sort.h> |