Skip to content

Commit be9b334

Browse files
[oneDPL] Add reverse_copy and unique_copy parallel range algorithms (#635)
1 parent 32a3028 commit be9b334

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ The following differences to the standard serial C++ range algorithms apply:
3434
In that case, the returned value contains iterators pointing to the positions past the last elements
3535
processed according to the algorithm semantics.
3636
- ``for_each`` does not return its function object.
37+
- The return type of ``reverse_copy`` is ``std::ranges::in_in_out_result``
38+
rather than ``std::ranges::reverse_copy_result``.
39+
The semantics of the returned value are as specified in
40+
`P3709R2 <https://isocpp.org/files/papers/P3709R2.html>`_.
3741

3842
[*Note*: These oneDPL algorithms mostly match the semantics of the parallel range algorithms in the C++26 working draft.
3943
-- *end note*]
@@ -430,6 +434,17 @@ Copying Mutating Operations
430434
std::ranges::borrowed_iterator_t<OutR>>
431435
move (ExecutionPolicy&& pol, R&& r, OutR&& result);
432436
437+
// reverse_copy
438+
template <typename ExecutionPolicy, std::ranges::random_access_range R,
439+
std::ranges::random_access_range OutR>
440+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
441+
std::ranges::sized_range<R> && std::ranges::sized_range<OutR> &&
442+
std::indirectly_copyable<std::ranges::iterator_t<R>, std::ranges::iterator_t<OutR>>
443+
std::ranges::in_in_out_result<std::ranges::borrowed_iterator_t<R>,
444+
std::ranges::borrowed_iterator_t<R>,
445+
std::ranges::borrowed_iterator_t<OutR>>
446+
reverse_copy (ExecutionPolicy&& pol, R&& r, OutR&& result);
447+
433448
// transform (unary)
434449
template <typename ExecutionPolicy, std::ranges::random_access_range R,
435450
std::ranges::random_access_range OutR, std::copy_constructible Fn,
@@ -459,6 +474,18 @@ Copying Mutating Operations
459474
transform (ExecutionPolicy&& pol, R1&& r1, R2&& r2, OutR&& result, Fn binary_op,
460475
Proj1 proj1 = {}, Proj2 proj2 = {});
461476
477+
// unique_copy
478+
template <typename ExecutionPolicy, std::ranges::random_access_range R,
479+
std::ranges::random_access_range OutR, typename Proj = std::identity,
480+
std::indirect_equivalence_relation<std::projected<std::ranges::iterator_t<R>, Proj>>
481+
Comp = std::ranges::equal_to>
482+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
483+
std::ranges::sized_range<R> && std::ranges::sized_range<OutR> &&
484+
std::indirectly_copyable<std::ranges::iterator_t<R>, std::ranges::iterator_t<OutR>>
485+
std::ranges::unique_copy_result<std::ranges::borrowed_iterator_t<R>,
486+
std::ranges::borrowed_iterator_t<OutR>>
487+
unique_copy (ExecutionPolicy&& pol, R&& r, OutR&& result, Comp comp = {}, Proj proj = {});
488+
462489
}
463490
464491
In-place Mutating Operations

0 commit comments

Comments
 (0)