diff options
author | Nikolas Klauser <nikolasklauser@berlin.de> | 2022-03-12 01:45:35 +0100 |
---|---|---|
committer | Nikolas Klauser <nikolasklauser@berlin.de> | 2022-03-12 01:46:02 +0100 |
commit | ee0f8c4010309a25c95115a9f727a02741e2de48 (patch) | |
tree | bda734fd44736ef7a37bfe458ac0bd34f239b8d7 /libcxx/include/algorithm | |
parent | 55a970fbd444a42be5c12f11787b999097e6f7ea (diff) | |
download | llvm-ee0f8c4010309a25c95115a9f727a02741e2de48.zip llvm-ee0f8c4010309a25c95115a9f727a02741e2de48.tar.gz llvm-ee0f8c4010309a25c95115a9f727a02741e2de48.tar.bz2 |
[libc++][ranges] Implement ranges::find{, _if, _if_not}
Reviewed By: var-const, #libc, ldionne
Spies: ldionne, tcanens, libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D121248
Diffstat (limited to 'libcxx/include/algorithm')
-rw-r--r-- | libcxx/include/algorithm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm index 72fdb29..6fe66e42 100644 --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -56,6 +56,33 @@ namespace ranges { requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 + + template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity> + requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> + constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20 + + template<input_range R, class T, class Proj = identity> + requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> + constexpr borrowed_iterator_t<R> + find(R&& r, const T& value, Proj proj = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + constexpr borrowed_iterator_t<R> + find_if(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + constexpr borrowed_iterator_t<R> + find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20 } template <class InputIterator, class Predicate> @@ -775,6 +802,9 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/pop_heap.h> #include <__algorithm/prev_permutation.h> #include <__algorithm/push_heap.h> +#include <__algorithm/ranges_find.h> +#include <__algorithm/ranges_find_if.h> +#include <__algorithm/ranges_find_if_not.h> #include <__algorithm/ranges_max_element.h> #include <__algorithm/ranges_min_element.h> #include <__algorithm/ranges_mismatch.h> |