hpx::rotate, hpx::rotate_copy
hpx::rotate, hpx::rotate_copy#
Defined in header hpx/algorithm.hpp.
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace hpx
Functions
-
template<typename FwdIter>
FwdIter rotate(FwdIter first, FwdIter new_first, FwdIter last)# Performs a left rotation on a range of elements. Specifically, rotate swaps the elements in the range [first, last) in such a way that the element new_first becomes the first element of the new range and new_first - 1 becomes the last element.
The assignments in the parallel rotate algorithm execute in sequential order in the calling thread.
Note
Complexity: Linear in the distance between first and last.
Note
The type of dereferenced FwdIter must meet the requirements of MoveAssignable and MoveConstructible.
- Template Parameters
FwdIter – The type of the source iterators used (deduced). This iterator type must meet the requirements of a forward iterator.
- Parameters
first – Refers to the beginning of the sequence of elements the algorithm will be applied to.
new_first – Refers to the element that should appear at the beginning of the rotated range.
last – Refers to the end of the sequence of elements the algorithm will be applied to.
- Returns
The rotate algorithm returns a FwdIter. The rotate algorithm returns the iterator to the new location of the element pointed by first,equal to first + (last - new_first).
-
template<typename ExPolicy, typename FwdIter>
hpx::parallel::util::detail::algorithm_result_t<ExPolicy, FwdIter> rotate(ExPolicy &&policy, FwdIter first, FwdIter new_first, FwdIter last)# Performs a left rotation on a range of elements. Specifically, rotate swaps the elements in the range [first, last) in such a way that the element new_first becomes the first element of the new range and new_first - 1 becomes the last element. Executed according to the policy.
The assignments in the parallel rotate algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.
The assignments in the parallel rotate 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.
Note
The type of dereferenced FwdIter must meet the requirements of MoveAssignable and MoveConstructible.
- 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.
FwdIter – The type of the source iterators used (deduced). This iterator type must meet the requirements of a forward 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.
new_first – Refers to the element that should appear at the beginning of the rotated range.
last – Refers to the end of the sequence of elements the algorithm will be applied to.
- Returns
The rotate algorithm returns a hpx::future<FwdIter> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns FwdIter otherwise. The rotate algorithm returns the iterator equal to first + (last - new_first).
-
template<typename FwdIter, typename OutIter>
OutIter rotate_copy(FwdIter first, FwdIter new_first, FwdIter last, OutIter dest_first)# Copies the elements from the range [first, last), to another range beginning at dest_first in such a way, that the element new_first becomes the first element of the new range and new_first - 1 becomes the last element.
The assignments in the parallel rotate_copy algorithm execute in sequential order in the calling thread.
Note
Complexity: Performs exactly last - first assignments.
- Template Parameters
FwdIter – The type of the source iterators used (deduced). This iterator type must meet the requirements of a forward iterator.
OutIter – The type of the source iterators used (deduced). This iterator type must meet the requirements of a output iterator.
- Parameters
first – Refers to the beginning of the sequence of elements the algorithm will be applied to.
new_first – Refers to the element that should appear at the beginning of the rotated range.
last – Refers to the end of the sequence of elements the algorithm will be applied to.
dest_first – Refers to the begin of the destination range.
- Returns
The rotate_copy algorithm returns a output iterator, The rotate_copy algorithm returns the output iterator to the element past the last element copied.
-
template<typename ExPolicy, typename FwdIter1, typename FwdIter2>
hpx::parallel::util::detail::algorithm_result_t<ExPolicy, FwdIter2> rotate_copy(ExPolicy &&policy, FwdIter1 first, FwdIter1 new_first, FwdIter1 last, FwdIter2 dest_first)# Copies the elements from the range [first, last), to another range beginning at dest_first in such a way, that the element new_first becomes the first element of the new range and new_first - 1 becomes the last element. Executed according to the policy.
The assignments in the parallel rotate_copy algorithm execute in sequential order in the calling thread.
The assignments in the parallel rotate_copy algorithm execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each 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.
FwdIter1 – The type of the source iterators used (deduced). This iterator type must meet the requirements of a forward iterator.
FwdIter2 – The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of a forward 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.
new_first – Refers to the element that should appear at the beginning of the rotated range.
last – Refers to the end of the sequence of elements the algorithm will be applied to.
dest_first – Refers to the begin of the destination range.
- Returns
The rotate_copy algorithm returns a hpx::future<FwdIter2> if the execution policy is of type parallel_task_policy and returns FwdIter2 otherwise. The rotate_copy algorithm returns the output iterator to the element past the last element copied.
-
template<typename FwdIter>