Skip to content

Commit cb36adf

Browse files
[oneDPL][ranges] Add partition algorithms (#644)
1 parent fdd2a5f commit cb36adf

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

source/elements/oneDPL/source/parallel_api/parallel_range_api.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,59 @@ Set operations
535535
536536
}
537537
538+
Partition operations
539+
++++++++++++++++++++
540+
541+
.. code:: cpp
542+
543+
// Defined in <oneapi/dpl/algorithm>
544+
545+
namespace oneapi::dpl::ranges {
546+
547+
// is_partitioned
548+
template <typename ExecutionPolicy, std::ranges::random_access_range R,
549+
typename Proj = std::identity,
550+
std::indirect_unary_predicate< std::projected<std::ranges::iterator_t<R>, Proj> > Pred>
551+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
552+
std::ranges::sized_range<R>
553+
bool is_partitioned (ExecutionPolicy&& pol, R&& r, Pred pred, Proj proj = {});
554+
555+
// partition
556+
template <typename ExecutionPolicy, std::ranges::random_access_range R,
557+
typename Proj = std::identity,
558+
std::indirect_unary_predicate< std::projected<std::ranges::iterator_t<R>, Proj> > Pred>
559+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
560+
std::ranges::sized_range<R> && std::permutable<std::ranges::iterator_t<R>>
561+
std::ranges::borrowed_subrange_t<R>
562+
partition (ExecutionPolicy&& pol, R&& r, Pred pred, Proj proj = {});
563+
564+
// stable_partition
565+
template <typename ExecutionPolicy, std::ranges::random_access_range R,
566+
typename Proj = std::identity,
567+
std::indirect_unary_predicate< std::projected<std::ranges::iterator_t<R>, Proj> > Pred>
568+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
569+
std::ranges::sized_range<R> && std::permutable<std::ranges::iterator_t<R>>
570+
std::ranges::borrowed_subrange_t<R>
571+
stable_partition (ExecutionPolicy&& pol, R&& r, Pred pred, Proj proj = {});
572+
573+
// partition_copy
574+
template <typename ExecutionPolicy, std::ranges::random_access_range R,
575+
std::ranges::random_access_range OutR1, std::ranges::random_access_range OutR2,
576+
typename Proj = std::identity,
577+
std::indirect_unary_predicate< std::projected<std::ranges::iterator_t<R>, Proj> > Pred>
578+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
579+
std::ranges::sized_range<R> && std::ranges::sized_range<OutR1> &&
580+
std::ranges::sized_range<OutR2> &&
581+
std::indirectly_copyable<std::ranges::iterator_t<R>, std::ranges::iterator_t<OutR1>> &&
582+
std::indirectly_copyable<std::ranges::iterator_t<R>, std::ranges::iterator_t<OutR2>>
583+
std::ranges::partition_copy_result<std::ranges::borrowed_iterator_t<R>,
584+
std::ranges::borrowed_iterator_t<OutR1>,
585+
std::ranges::borrowed_iterator_t<OutR2>>
586+
partition_copy (ExecutionPolicy&& pol, R&& r, OutR1&& out_true_r, OutR2&& out_false_r,
587+
Pred pred, Proj proj = {});
588+
589+
}
590+
538591
Copying Mutating Operations
539592
+++++++++++++++++++++++++++
540593

0 commit comments

Comments
 (0)