hpx::ranges::reverse#
Defined in header hpx/algorithm.hpp.
See Public API for a list of names and headers that are part of the public HPX API.
See also:
-
template<typename Iter, typename Sent>
Iter hpx::ranges::reverse(Iter first, Sent sent)# 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.
sent – Refers to the end of the sequence of elements the algorithm will be applied to.
- Returns:
The reverse algorithm returns a Iter. It returns last.
-
template<typename Rng>
std::ranges::iterator_t<Rng> hpx::ranges::reverse(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.
- Returns:
The reverse algorithm returns a hpx::traits::range_iterator<Rng>::type. It returns last.
-
template<typename ExPolicy, typename Iter, typename Sent>
hpx::parallel::util::detail::algorithm_result_t<ExPolicy, Iter> hpx::ranges::reverse(ExPolicy &&policy, Iter first, Sent sent)# 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.
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.
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.
sent – Refers to the end of the sequence of elements the algorithm will be applied to.
- Returns:
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, typename Rng>
parallel::util::detail::algorithm_result<ExPolicy, std::ranges::iterator_t<Rng>> hpx::ranges::reverse(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.
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.
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.
- Returns:
The reverse algorithm returns a hpx::future<std::ranges::iterator_t<Rng>> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns hpx::future< std::ranges::iterator_t<Rng>> otherwise. It returns last.