diff options
author | Nikolas Klauser <nikolasklauser@berlin.de> | 2022-05-26 16:42:46 +0200 |
---|---|---|
committer | Nikolas Klauser <nikolasklauser@berlin.de> | 2022-05-26 16:50:08 +0200 |
commit | 0e3dc1a52ffe8a2c7464d6acaeaec23eca21f4f4 (patch) | |
tree | 90faaccafd6d2055275f9e5468c70c5de73960ea /libcxx/include/algorithm | |
parent | 14258d6fb5f311033def5f11432958315fa63683 (diff) | |
download | llvm-0e3dc1a52ffe8a2c7464d6acaeaec23eca21f4f4.zip llvm-0e3dc1a52ffe8a2c7464d6acaeaec23eca21f4f4.tar.gz llvm-0e3dc1a52ffe8a2c7464d6acaeaec23eca21f4f4.tar.bz2 |
[libc++] Implement ranges::{all, any, none}_of
Reviewed By: ldionne, var-const, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D123016
Diffstat (limited to 'libcxx/include/algorithm')
-rw-r--r-- | libcxx/include/algorithm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm index aa21914..30f647c 100644 --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -305,6 +305,30 @@ namespace ranges { constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + template<input_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr bool ranges::all_of(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 bool ranges::all_of(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 bool ranges::any_of(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 bool ranges::any_of(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 bool ranges::none_of(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 bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + } constexpr bool // constexpr in C++20 @@ -1021,6 +1045,8 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/pop_heap.h> #include <__algorithm/prev_permutation.h> #include <__algorithm/push_heap.h> +#include <__algorithm/ranges_all_of.h> +#include <__algorithm/ranges_any_of.h> #include <__algorithm/ranges_copy.h> #include <__algorithm/ranges_copy_backward.h> #include <__algorithm/ranges_copy_if.h> @@ -1043,6 +1069,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_minmax.h> #include <__algorithm/ranges_minmax_element.h> #include <__algorithm/ranges_mismatch.h> +#include <__algorithm/ranges_none_of.h> #include <__algorithm/ranges_reverse.h> #include <__algorithm/ranges_swap_ranges.h> #include <__algorithm/ranges_transform.h> |