aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/algorithm
diff options
context:
space:
mode:
authorHui Xie <hui.xie1990@gmail.com>2022-07-19 20:54:35 +0100
committerHui Xie <hui.xie1990@gmail.com>2022-07-22 10:27:48 +0100
commitc559964d85e8efc1f6949df940df9265a0ac0663 (patch)
treed96d969f9a5ded083baba3cb34461bf82b80f1f4 /libcxx/include/algorithm
parent0f6364b8a1007e9cfbde331321115f9385bd6b17 (diff)
downloadllvm-c559964d85e8efc1f6949df940df9265a0ac0663.zip
llvm-c559964d85e8efc1f6949df940df9265a0ac0663.tar.gz
llvm-c559964d85e8efc1f6949df940df9265a0ac0663.tar.bz2
[libc++][ranges] implement `std::ranges::includes`
implement `std::ranges::includes` and delegate to `std::includes` Differential Revision: https://reviews.llvm.org/D130116
Diffstat (limited to 'libcxx/include/algorithm')
-rw-r--r--libcxx/include/algorithm15
1 files changed, 15 insertions, 0 deletions
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 19cf3b8..aea6ad8 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -801,6 +801,20 @@ namespace ranges {
constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
+
+ template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
+ class Proj1 = identity, class Proj2 = identity,
+ indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
+ ranges::less>
+ constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
+ Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20
+
+ template<input_range R1, input_range R2, class Proj1 = identity,
+ class Proj2 = identity,
+ indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
+ projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
+ constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
+ Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20
}
constexpr bool // constexpr in C++20
@@ -1551,6 +1565,7 @@ template <class BidirectionalIterator, class Compare>
#include <__algorithm/ranges_find_if_not.h>
#include <__algorithm/ranges_for_each.h>
#include <__algorithm/ranges_for_each_n.h>
+#include <__algorithm/ranges_includes.h>
#include <__algorithm/ranges_is_partitioned.h>
#include <__algorithm/ranges_is_sorted.h>
#include <__algorithm/ranges_is_sorted_until.h>