[libc++][ranges] Implement `std::ranges::partition_{point,copy}`.
Reviewed By: #libc, huixie90, ldionne
Differential Revision: https://reviews.llvm.org/D130070
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 71d507a..88c7665 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -581,6 +581,34 @@
constexpr ranges::move_result<borrowed_iterator_t<R>, O>
ranges::move(R&& r, O result); // since C++20
+ template<class I, class O1, class O2>
+ using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20
+
+ template<input_iterator I, sentinel_for<I> S,
+ weakly_incrementable O1, weakly_incrementable O2,
+ class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
+ requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
+ constexpr partition_copy_result<I, O1, O2>
+ partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
+ Proj proj = {}); // Since C++20
+
+ template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
+ class Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
+ requires indirectly_copyable<iterator_t<R>, O1> &&
+ indirectly_copyable<iterator_t<R>, O2>
+ constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
+ partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // Since C++20
+
+ template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
+ indirect_unary_predicate<projected<I, Proj>> Pred>
+ constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // Since C++20
+
+ template<forward_range R, class Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
+ constexpr borrowed_iterator_t<R>
+ partition_point(R&& r, Pred pred, Proj proj = {}); // Since C++20
+
template<class I1, class I2, class O>
using merge_result = in_in_out_result<I1, I2, O>; // since C++20
@@ -1531,6 +1559,8 @@
#include <__algorithm/ranges_nth_element.h>
#include <__algorithm/ranges_partial_sort.h>
#include <__algorithm/ranges_partition.h>
+#include <__algorithm/ranges_partition_copy.h>
+#include <__algorithm/ranges_partition_point.h>
#include <__algorithm/ranges_pop_heap.h>
#include <__algorithm/ranges_push_heap.h>
#include <__algorithm/ranges_remove.h>