Skip to content

Commit c64b530

Browse files
[oneDPL] Add memory parallel range algorithms (#631)
Co-authored-by: Dan Hoeflinger <[email protected]>
1 parent be9b334 commit c64b530

File tree

1 file changed

+84
-2
lines changed

1 file changed

+84
-2
lines changed

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

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ The following differences to the standard serial C++ range algorithms apply:
3838
rather than ``std::ranges::reverse_copy_result``.
3939
The semantics of the returned value are as specified in
4040
`P3709R2 <https://isocpp.org/files/papers/P3709R2.html>`_.
41+
- ``destroy`` is not marked with ``noexcept``.
4142

4243
[*Note*: These oneDPL algorithms mostly match the semantics of the parallel range algorithms in the C++26 working draft.
4344
-- *end note*]
@@ -51,9 +52,25 @@ of parallel range algorithms.
5152
.. code:: cpp
5253
5354
// C++20 analogue of std::projected_value_t; exposition only
54-
template<typename I, typename Proj>
55+
template <typename I, typename Proj>
5556
using /*projected-value-type*/ = std::remove_cvref_t<std::invoke_result_t<Proj&, std::iter_value_t<I>&>>;
5657
58+
// C++20 analogue of nothrow-random-access-range in the C++26 working draft; exposition only
59+
// Semantic requirements are listed further below
60+
template <typename R>
61+
concept nothrow-random-access-range =
62+
std::ranges::random_access_range<R> &&
63+
std::is_lvalue_reference_v<std::iter_reference_t<std::ranges::iterator_t<R>>> &&
64+
std::same_as<std::remove_cvref_t<std::iter_reference_t<std::ranges::iterator_t<R>>>,
65+
std::iter_value_t<std::ranges::iterator_t<R>>>;
66+
67+
A type ``R`` models ``nothrow-random-access-range`` if no exceptions are thrown from:
68+
69+
- any operation on an object of type ``std::ranges::iterator_t<R>``
70+
required by the ``std::random_access_iterator`` concept;
71+
- calls to ``std::ranges::begin()``, ``std::ranges::end()`` and ``std::ranges::size()``
72+
on an object of type ``R``.
73+
5774
Whole Sequence Operations
5875
+++++++++++++++++++++++++
5976

@@ -293,7 +310,6 @@ Sequence Search and Comparison
293310
std::ranges::borrowed_iterator_t<R2>>
294311
mismatch (ExecutionPolicy&& pol, R1&& r1, R2&& r2, Pred pred = {},
295312
Proj1 proj1 = {}, Proj2 proj2 = {});
296-
297313
298314
// find_end
299315
template<typename ExecutionPolicy, std::ranges::random_access_range R1,
@@ -581,5 +597,71 @@ In-place Mutating Operations
581597
582598
}
583599
600+
Uninitialized Memory Algorithms
601+
+++++++++++++++++++++++++++++++
602+
603+
.. code:: cpp
604+
605+
// Defined in <oneapi/dpl/memory>
606+
607+
namespace oneapi::dpl::ranges {
608+
609+
// uninitialized_default_construct
610+
template <typename ExecutionPolicy, /*nothrow-random-access-range*/ R>
611+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
612+
std::ranges::sized_range<R> &&
613+
std::default_initializable<std::ranges::range_value_t<R>>
614+
std::ranges::borrowed_iterator_t<R>
615+
uninitialized_default_construct (ExecutionPolicy&& pol, R&& r);
616+
617+
// uninitialized_value_construct
618+
template <typename ExecutionPolicy, /*nothrow-random-access-range*/ R>
619+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
620+
std::ranges::sized_range<R> &&
621+
std::default_initializable<std::ranges::range_value_t<R>>
622+
std::ranges::borrowed_iterator_t<R>
623+
uninitialized_value_construct (ExecutionPolicy&& pol, R&& r);
624+
625+
// uninitialized_copy
626+
template <typename ExecutionPolicy, std::random_access_range IR,
627+
/*nothrow-random-access-range*/ OR>
628+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
629+
std::ranges::sized_range<IR> && std::ranges::sized_range<OR> &&
630+
std::constructible_from<std::ranges::range_value_t<OR>,
631+
std::ranges::range_reference_t<IR>>
632+
std::ranges::uninitialized_copy_result<std::ranges::borrowed_iterator_t<IR>,
633+
std::ranges::borrowed_iterator_t<OR>>
634+
uninitialized_copy (ExecutionPolicy&& pol, IR&& in_range, OR&& out_range);
635+
636+
// uninitialized_move
637+
template <typename ExecutionPolicy, std::ranges::random_access_range IR,
638+
/*nothrow-random-access-range*/ OR>
639+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
640+
std::ranges::sized_range<IR> && std::ranges::sized_range<OR> &&
641+
std::constructible_from<std::ranges::range_value_t<OR>,
642+
std::ranges::range_rvalue_reference_t<IR>>
643+
std::ranges::uninitialized_move_result<std::ranges::borrowed_iterator_t<IR>,
644+
std::ranges::borrowed_iterator_t<OR>>
645+
uninitialized_move (ExecutionPolicy&& pol, IR&& in_range, OR&& out_range);
646+
647+
// uninitialized_fill
648+
template <typename ExecutionPolicy, /*nothrow-random-access-range*/ R,
649+
typename T = std::ranges::range_value_t<R>>
650+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
651+
std::ranges::sized_range<R> &&
652+
std::constructible_from<std::ranges::range_value_t<R>, const T&>
653+
std::ranges::borrowed_iterator_t<R>
654+
uninitialized_fill (ExecutionPolicy&& pol, R&& r, const T& value);
655+
656+
// destroy
657+
template <typename ExecutionPolicy, /*nothrow-random-access-range*/ R>
658+
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
659+
std::ranges::sized_range<R> &&
660+
std::destructible<std::ranges::range_value_t<R>>
661+
std::ranges::borrowed_iterator_t<R>
662+
destroy (ExecutionPolicy&& pol, R&& r);
663+
664+
}
665+
584666
.. _`C++ Standard`: https://isocpp.org/std/the-standard
585667
.. _`SYCL`: https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html

0 commit comments

Comments
 (0)