hpx/parallel/container_algorithms/reverse.hpp¶
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace
hpx
-
namespace
ranges
Functions
-
template<typename
Iter
, typenameSent
>
Iterreverse
(Iter first, Sent last)¶ Reverses the order of the elements in the range [first, last). Behaves as if applying std::iter_swap to every pair of iterators first+i, (last-i) - 1 for each non-negative i < (last-first)/2.
The assignments in the parallel
reverse algorithm execute in sequential order in the calling thread.- Note
Complexity: Linear in the distance between first and last.
- Template Parameters
Iter
: The type of the source iterator used (deduced). The iterator type must meet the requirements of an input iterator.Sent
: The type of the end iterators used (deduced). This sentinel type must be a sentinel for Iter.
- Parameters
first
: Refers to the beginning of the sequence of elements the algorithm will be applied to.last
: Refers to the end of the sequence of elements the algorithm will be applied to.
- Return
The reverse algorithm returns a Iter. It returns last.
-
template<typename
Rng
>
hpx::traits::range_iterator<Rng>::typereverse
(Rng &&rng)¶ Uses rng as the source range, as if using util::begin(rng) as first and ranges::end(rng) as last. Reverses the order of the elements in the range [first, last). Behaves as if applying std::iter_swap to every pair of iterators first+i, (last-i) - 1 for each non-negative i < (last-first)/2.
The assignments in the parallel
reverse algorithm execute in sequential order in the calling thread.- Note
Complexity: Linear in the distance between first and last.
- Template Parameters
Rng
: The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of a bidirectional iterator.
- Parameters
rng
: Refers to the sequence of elements the algorithm will be applied to.
- Return
The reverse algorithm returns a hpx::traits::range_iterator<Rng>::type. It returns last.
-
template<typename
ExPolicy
, typenameIter
, typenameSent
>
parallel::util::detail::algorithm_result<ExPolicy, Iter>::typereverse
(ExPolicy &&policy, Iter first, Sent last)¶ Reverses the order of the elements in the range [first, last). Behaves as if applying std::iter_swap to every pair of iterators first+i, (last-i) - 1 for each non-negative i < (last-first)/2.
The assignments in the parallel
reverse algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.- Note
Complexity: Linear in the distance between first and last.
- Template Parameters
ExPolicy
: The type of the execution policy to use (deduced). It describes the manner in which the execution of the algorithm may be parallelized and the manner in which it executes the assignments.Iter
: The type of the source iterator used (deduced). The iterator type must meet the requirements of an input iterator.Sent
: The type of the end iterators used (deduced). This sentinel type must be a sentinel for Iter.
- Parameters
policy
: The execution policy to use for the scheduling of the iterations.first
: Refers to the beginning of the sequence of elements the algorithm will be applied to.last
: Refers to the end of the sequence of elements the algorithm will be applied to.
The assignments in the parallel reverse algorithm invoked with an execution policy object of type parallel_policy or parallel_task_policy are permitted to execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each thread.
- Return
The reverse algorithm returns a hpx::future<Iter> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns Iter otherwise. It returns last.
-
template<typename
ExPolicy
, typenameRng
>
parallel::util::detail::algorithm_result<ExPolicy, typename hpx::traits::range_iterator<Rng>::type>::typereverse
(ExPolicy &&policy, Rng &&rng)¶ Uses rng as the source range, as if using util::begin(rng) as first and ranges::end(rng) as last. Reverses the order of the elements in the range [first, last). Behaves as if applying std::iter_swap to every pair of iterators first+i, (last-i) - 1 for each non-negative i < (last-first)/2.
The assignments in the parallel
reverse algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.- Note
Complexity: Linear in the distance between first and last.
- Template Parameters
ExPolicy
: The type of the execution policy to use (deduced). It describes the manner in which the execution of the algorithm may be parallelized and the manner in which it executes the assignments.Rng
: The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of a bidirectional iterator.
- Parameters
policy
: The execution policy to use for the scheduling of the iterations.rng
: Refers to the sequence of elements the algorithm will be applied to.
The assignments in the parallel reverse algorithm invoked with an execution policy object of type parallel_policy or parallel_task_policy are permitted to execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each thread.
- Return
The reverse algorithm returns a hpx::future<typename hpx::traits::range_iterator<Rng>::type> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns hpx::future< typename hpx::traits::range_iterator<Rng>::type> otherwise. It returns last.
-
template<typename
Iter
, typenameSent
, typenameOutIter
>
reverse_copy_result<Iter, OutIter>reverse_copy
(Iter first, Sent last, OutIter result)¶ Copies the elements from the range [first, last) to another range beginning at result in such a way that the elements in the new range are in reverse order. Behaves as if by executing the assignment *(result + (last - first) - 1 - i) = *(first + i) once for each non-negative i < (last - first) If the source and destination ranges (that is, [first, last) and [result, result+(last-first)) respectively) overlap, the behavior is undefined.
The assignments in the parallel
reverse_copy algorithm execute in sequential order in the calling thread.- Note
Complexity: Performs exactly last - first assignments.
- Template Parameters
Iter
: The type of the source iterator used (deduced). The iterator type must meet the requirements of an input iterator.Sent
: The type of the end iterators used (deduced). This sentinel type must be a sentinel for Iter.OutIter
: The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an output iterator.
- Parameters
first
: Refers to the beginning of the sequence of elements the algorithm will be applied to.last
: Refers to the end of the sequence of elements the algorithm will be applied to.result
: Refers to the begin of the destination range.
- Return
The reverse_copy algorithm returns a reverse_copy_result<Iter, OutIter>. The reverse_copy algorithm returns the pair of the input iterator forwarded to the first element after the last in the input sequence and the output iterator to the element in the destination range, one past the last element copied.
-
template<typename
Rng
, typenameOutIter
>
ranges::reverse_copy_result<typename hpx::traits::range_iterator<Rng>::type, OutIter>reverse_copy
(Rng &&rng, OutIter result)¶ Uses rng as the source range, as if using util::begin(rng) as first and ranges::end(rng) as last. Copies the elements from the range [first, last) to another range beginning at result in such a way that the elements in the new range are in reverse order. Behaves as if by executing the assignment *(result + (last - first) - 1 - i) = *(first + i) once for each non-negative i < (last - first) If the source and destination ranges (that is, [first, last) and [result, result+(last-first)) respectively) overlap, the behavior is undefined.
The assignments in the parallel
reverse_copy algorithm execute in sequential order in the calling thread.- Note
Complexity: Performs exactly last - first assignments.
- Template Parameters
Rng
: The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of a bidirectional iterator.OutputIter
: The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an output iterator.
- Parameters
rng
: Refers to the sequence of elements the algorithm will be applied to.result
: Refers to the begin of the destination range.
- Return
The reverse_copy algorithm returns a ranges::reverse_copy_result< typename hpx::traits::range_iterator<Rng>::type, OutIter>>::type. The reverse_copy algorithm returns an object equal to {last, result + N} where N = last - first
-
template<typename
ExPolicy
, typenameIter
, typenameSent
, typenameOutIter
>
parallel::util::detail::algorithm_result<ExPolicy, reverse_copy_result<Iter, OutIter>>::typereverse_copy
(ExPolicy &&policy, Iter first, Sent last, OutIter result)¶ Copies the elements from the range [first, last) to another range beginning at result in such a way that the elements in the new range are in reverse order. Behaves as if by executing the assignment *(result + (last - first) - 1 - i) = *(first + i) once for each non-negative i < (last - first) If the source and destination ranges (that is, [first, last) and [result, result+(last-first)) respectively) overlap, the behavior is undefined.
The assignments in the parallel
reverse_copy algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.- Note
Complexity: Performs exactly last - first assignments.
- Template Parameters
ExPolicy
: The type of the execution policy to use (deduced). It describes the manner in which the execution of the algorithm may be parallelized and the manner in which it executes the assignments.Iter
: The type of the source iterator used (deduced). The iterator type must meet the requirements of an input iterator.Sent
: The type of the end iterators used (deduced). This sentinel type must be a sentinel for Iter.OutIter
: The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an output iterator.
- Parameters
policy
: The execution policy to use for the scheduling of the iterations.first
: Refers to the beginning of the sequence of elements the algorithm will be applied to.last
: Refers to the end of the sequence of elements the algorithm will be applied to.result
: Refers to the begin of the destination range.
The assignments in the parallel reverse_copy algorithm invoked with an execution policy object of type parallel_policy or parallel_task_policy are permitted to execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each thread.
- Return
The reverse_copy algorithm returns a hpx::future<reverse_copy_result<Iter, OutIter> > if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns reverse_copy_result<Iter, OutIter> otherwise. The reverse_copy algorithm returns the pair of the input iterator forwarded to the first element after the last in the input sequence and the output iterator to the element in the destination range, one past the last element copied.
-
template<typename
ExPolicy
, typenameRng
, typenameOutIter
>
util::detail::algorithm_result<ExPolicy, ranges::reverse_copy_result<typename hpx::traits::range_iterator<Rng>::type, OutIter>>::typereverse_copy
(ExPolicy &&policy, Rng &&rng, OutIter result)¶ Uses rng as the source range, as if using util::begin(rng) as first and ranges::end(rng) as last. Copies the elements from the range [first, last) to another range beginning at result in such a way that the elements in the new range are in reverse order. Behaves as if by executing the assignment *(result + (last - first) - 1 - i) = *(first + i) once for each non-negative i < (last - first) If the source and destination ranges (that is, [first, last) and [result, result+(last-first)) respectively) overlap, the behavior is undefined.
The assignments in the parallel
reverse_copy algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.- Note
Complexity: Performs exactly last - first assignments.
- Template Parameters
ExPolicy
: The type of the execution policy to use (deduced). It describes the manner in which the execution of the algorithm may be parallelized and the manner in which it executes the assignments.Rng
: The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of a bidirectional iterator.OutputIter
: The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an output iterator.
- Parameters
policy
: The execution policy to use for the scheduling of the iterations.rng
: Refers to the sequence of elements the algorithm will be applied to.result
: Refers to the begin of the destination range.
The assignments in the parallel reverse_copy algorithm invoked with an execution policy object of type parallel_policy or parallel_task_policy are permitted to execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each thread.
- Return
The reverse_copy algorithm returns a hpx::future<ranges::reverse_copy_result< typename hpx::traits::range_iterator<Rng>::type, OutIter>> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns ranges::reverse_copy_result< typename hpx::traits::range_iterator<Rng>::type, OutIter> otherwise. The reverse_copy algorithm returns an object equal to {last, result + N} where N = last - first
-
template<typename
-
namespace