Skip to content

Commit 7de8761

Browse files
[oneDPL][ranges] Add shift_left, shift_right, rotate, and rotate_copy (#641)
1 parent b712078 commit 7de8761

File tree

1 file changed

+45
-2
lines changed

1 file changed

+45
-2
lines changed

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

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ 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``.
37+
- The return type of ``reverse_copy`` and ``rotate_copy`` is ``std::ranges::in_in_out_result``
38+
rather than ``std::ranges::reverse_copy_result`` and ``std::ranges::rotate_copy_result``, respectively.
3939
The semantics of the returned value are as specified in
4040
`P3709R2 <https://isocpp.org/files/papers/P3709R2.html>`_.
4141
- ``destroy`` is not marked with ``noexcept``.
@@ -900,6 +900,49 @@ In-place Mutating Operations
900900
901901
}
902902
903+
Sequence Reordering
904+
+++++++++++++++++++
905+
906+
.. code:: cpp
907+
908+
// Defined in <oneapi/dpl/algorithm>
909+
910+
namespace oneapi::dpl::ranges {
911+
912+
// shift_left
913+
template <typename ExecutionPolicy, std::ranges::random_access_range R>
914+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
915+
std::ranges::sized_range<R> && std::permutable<std::ranges::iterator_t<R>>
916+
std::ranges::borrowed_subrange_t<R>
917+
shift_left (ExecutionPolicy&& pol, R&& r, std::ranges::range_difference_t<R> n);
918+
919+
// shift_right
920+
template <typename ExecutionPolicy, std::ranges::random_access_range R>
921+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
922+
std::ranges::sized_range<R> && std::permutable<std::ranges::iterator_t<R>>
923+
std::ranges::borrowed_subrange_t<R>
924+
shift_right (ExecutionPolicy&& pol, R&& r, std::ranges::range_difference_t<R> n);
925+
926+
// rotate
927+
template <typename ExecutionPolicy, std::ranges::random_access_range R>
928+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
929+
std::ranges::sized_range<R> && std::permutable<std::ranges::iterator_t<R>>
930+
std::ranges::borrowed_subrange_t<R>
931+
rotate (ExecutionPolicy&& pol, R&& r, std::ranges::iterator_t<R> middle);
932+
933+
// rotate_copy
934+
template <typename ExecutionPolicy, std::ranges::random_access_range R,
935+
std::ranges::random_access_range OutR>
936+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
937+
std::ranges::sized_range<R> && std::ranges::sized_range<OutR> &&
938+
std::indirectly_copyable<std::ranges::iterator_t<R>, std::ranges::iterator_t<OutR>>
939+
std::ranges::in_in_out_result<std::ranges::borrowed_iterator_t<R>,
940+
std::ranges::borrowed_iterator_t<R>,
941+
std::ranges::borrowed_iterator_t<OutR>>
942+
rotate_copy (ExecutionPolicy&& pol, R&& r, std::ranges::iterator_t<R> middle, OutR&& result);
943+
944+
}
945+
903946
Uninitialized Memory Algorithms
904947
+++++++++++++++++++++++++++++++
905948

0 commit comments

Comments
 (0)