[libc++] Implement ranges::is_partitioned
Reviewed By: var-const, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D124440
NOKEYCHECK=True
GitOrigin-RevId: 37ba1b9d1ac729b1b05f11b684d352ec34646379
diff --git a/include/algorithm b/include/algorithm
index 13b3064..1a75dc0 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -256,6 +256,15 @@
indirectly_unary_invocable<projected<I, Proj>> Fun>
constexpr ranges::for_each_n_result<I, Fun>
ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, 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::is_partitioned(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::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20
+
}
constexpr bool // constexpr in C++20
@@ -983,6 +992,7 @@
#include <__algorithm/ranges_find_if_not.h>
#include <__algorithm/ranges_for_each.h>
#include <__algorithm/ranges_for_each_n.h>
+#include <__algorithm/ranges_is_partitioned.h>
#include <__algorithm/ranges_max.h>
#include <__algorithm/ranges_max_element.h>
#include <__algorithm/ranges_min.h>