hpx::rotate#
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 FwdIter>
FwdIter hpx::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> hpx::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).