Skip to content

Commit b69247a

Browse files
Keep only nothrow-random-access-range and its semantic requirements
1 parent a4516c2 commit b69247a

File tree

1 file changed

+28
-33
lines changed

1 file changed

+28
-33
lines changed

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

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -47,35 +47,30 @@ of parallel range algorithms.
4747
.. code:: cpp
4848
4949
// C++20 analogue of std::projected_value_t; exposition only
50-
template<typename I, typename Proj>
50+
template <typename I, typename Proj>
5151
using /*projected-value-type*/ = std::remove_cvref_t<std::invoke_result_t<Proj&, std::iter_value_t<I>&>>;
5252
53-
// Extension of C++20 exposition-only special memory concepts as defined in [special.mem.concepts]
54-
template<typename S, typename I>
55-
concept no-throw-sized-sentinel-for = // exposition only
56-
no-throw-sentinel-for<S, I> &&
57-
std::sized_sentinel_for<S, I>;
58-
59-
template<typename I>
60-
concept no-throw-bidirectional-iterator = // exposition only
61-
no-throw-forward-iterator<I> &&
62-
std::bidirectional_iterator<I>;
63-
64-
template<typename I>
65-
concept no-throw-random-access-iterator = // exposition only
66-
no-throw-bidirectional-iterator<I> &&
67-
std::random_access_iterator<I> &&
68-
no-throw-sized-sentinel-for<I, I>;
69-
70-
template<typename R>
71-
concept no-throw-bidirectional-range = // exposition only
72-
no-throw-forward-range<R> &&
73-
no-throw-bidirectional-iterator<std::ranges::iterator_t<R>>;
74-
75-
template<typename R>
76-
concept no-throw-random-access-range = // exposition only
77-
no-throw-bidirectional-range<R> &&
78-
no-throw-random-access-iterator<std::ranges::iterator_t<R>>;
53+
// C++20 analogue of nothrow-random-access-range proposed for C++26 in P3179R9; exposition only
54+
template <typename R>
55+
concept nothrow-random-access-range =
56+
std::ranges::random_access_range<R> &&
57+
std::is_lvalue_reference_v<std::iter_reference_t<I>> &&
58+
std::same_as<std::remove_cvref_t<std::iter_reference_t<I>>, std::iter_value_t<I>> &&
59+
std::sized_sentinel_for<std::ranges::sentinel_t<R>, std::ranges::iterator_t<R>>;
60+
61+
Semantic Requirements
62+
~~~~~~~~~~~~~~~~~~~~
63+
64+
A type ``R`` models ``nothrow-random-access-range`` if no exceptions are thrown from:
65+
66+
- increment, decrement, copy construction, move construction, copy assignment, move assignment,
67+
comparisons or indirection through valid iterators of type ``std::ranges::iterator_t<R>``;
68+
- ``-`` operator, copy construction, move construction, copy assignment, move assignment,
69+
or comparisons between valid values of type ``std::ranges::iterator_t<R>`` and ``std::ranges::sentinel_t<R>``;
70+
- ``-``, ``+``, ``-=``, ``+=``, ``[]`` operators on valid values of type
71+
``std::ranges::iterator_t<R>`` and ``std::iter_difference_t<std::ranges::iterator_t<R>>``;
72+
- calls to ``std::ranges::begin()``, ``std::ranges::end()`` and ``std::ranges::size()``
73+
on an object of type ``R``.
7974

8075
Whole Sequence Operations
8176
+++++++++++++++++++++++++
@@ -564,23 +559,23 @@ Uninitialized Memory Algorithms
564559
namespace oneapi::dpl::ranges {
565560
566561
// uninitialized_default_construct
567-
template <typename ExecutionPolicy, /*no-throw-random-access-range*/ R>
562+
template <typename ExecutionPolicy, /*nothrow-random-access-range*/ R>
568563
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
569564
std::ranges::sized_range<R> &&
570565
std::default_initializable<std::ranges::range_value_t<R>>
571566
std::ranges::borrowed_iterator_t<R>
572567
uninitialized_default_construct (ExecutionPolicy&& pol, R&& r);
573568
574569
// uninitialized_value_construct
575-
template <typename ExecutionPolicy, /*no-throw-random-access-range*/ R>
570+
template <typename ExecutionPolicy, /*nothrow-random-access-range*/ R>
576571
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
577572
std::ranges::sized_range<R> &&
578573
std::default_initializable<std::ranges::range_value_t<R>>
579574
std::ranges::borrowed_iterator_t<R>
580575
uninitialized_value_construct (ExecutionPolicy&& pol, R&& r, const std::ranges::range_value_t<R>& value);
581576
582577
// uninitialized_copy
583-
template <typename ExecutionPolicy, std::random_access_range IR, /*no-throw-random-access-range*/ OR>
578+
template <typename ExecutionPolicy, std::random_access_range IR, /*nothrow-random-access-range*/ OR>
584579
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
585580
std::ranges::sized_range<IR> && std::ranges::sized_range<OR> &&
586581
std::constructible_from<std::ranges::range_value_t<OR>, std::ranges::range_reference_t<IR>>
@@ -590,7 +585,7 @@ Uninitialized Memory Algorithms
590585
591586
// uninitialized_move
592587
template <typename ExecutionPolicy, std::ranges::random_access_range IR,
593-
/*no-throw-random-access-range*/ OR>
588+
/*nothrow-random-access-range*/ OR>
594589
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
595590
std::ranges::sized_range<IR> && std::ranges::sized_range<OR> &&
596591
std::constructible_from<std::ranges::range_value_t<OR>, std::ranges::range_reference_t<IR>>
@@ -599,7 +594,7 @@ Uninitialized Memory Algorithms
599594
uninitialized_move (ExecutionPolicy&& pol, IR&& in_range, OR&& out_range);
600595
601596
// uninitialized_fill
602-
template <typename ExecutionPolicy, /*no-throw-random-access-range*/ R,
597+
template <typename ExecutionPolicy, /*nothrow-random-access-range*/ R,
603598
typename T>
604599
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
605600
std::ranges::sized_range<R> &&
@@ -608,7 +603,7 @@ Uninitialized Memory Algorithms
608603
uninitialized_fill (ExecutionPolicy&& pol, R&& r, const T& value);
609604
610605
// destroy
611-
template <typename ExecutionPolicy, /*no-throw-random-access-range*/ R>
606+
template <typename ExecutionPolicy, /*nothrow-random-access-range*/ R>
612607
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> &&
613608
std::ranges::sized_range<R> &&
614609
std::destructible<std::ranges::range_value_t<R>>

0 commit comments

Comments
 (0)