diff options
| author | Zijun Zhao <zijunzhao@google.com> | 2023-09-18 11:28:11 -0700 |
|---|---|---|
| committer | Zijun Zhao <zijunzhao@google.com> | 2023-09-18 11:56:10 -0700 |
| commit | 0218ea4aaa5478d4a55c3f73735d90968c8cbace (patch) | |
| tree | 5ad1e2ae47e8e10ada040770b7ea313d3f8b2ff8 /libcxx/include/algorithm | |
| parent | b76e08db9c14741850a366da7bbe3c80ad50e456 (diff) | |
[libc++] Implement ranges::ends_with
Reviewed By: #libc, var-const
Differential Revision: https://reviews.llvm.org/D150831
Diffstat (limited to 'libcxx/include/algorithm')
| -rw-r--r-- | libcxx/include/algorithm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm index 76e0d22bf73e..69ba9537dda6 100644 --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -447,6 +447,22 @@ namespace ranges { 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 I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires (forward_iterator<I1> || sized_sentinel_for<S1, I1>) && + (forward_iterator<I2> || sized_sentinel_for<S2, I2>) && + indirectly_comparable<I1, I2, Pred, Proj1, Proj2> + constexpr bool ranges::ends_with(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 + + template<input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity, + class Proj2 = identity> + requires (forward_range<R1> || sized_range<R1>) && + (forward_range<R2> || sized_range<R2>) && + indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> + constexpr bool ranges::ends_with(R1&& r1, R2&& r2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++23 + 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 @@ -1833,6 +1849,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/ranges_copy_n.h> #include <__algorithm/ranges_count.h> #include <__algorithm/ranges_count_if.h> +#include <__algorithm/ranges_ends_with.h> #include <__algorithm/ranges_equal.h> #include <__algorithm/ranges_equal_range.h> #include <__algorithm/ranges_fill.h> |
