hpx/parallel/container_algorithms/rotate.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 FwdIter, typename Sent>
subrange_t<FwdIter, Sent> rotate(FwdIter first, FwdIter middle, Sent 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 middle becomes the first element of the new range and middle - 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 an forward iterator.

  • Sent – The type of the end iterators used (deduced). This sentinel type must be a sentinel for FwdIter.

Parameters
  • first – Refers to the beginning of the sequence of elements the algorithm will be applied to.

  • middle – 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 subrange_t<FwdIter, Sent>. The rotate algorithm returns the iterator equal to pair(first + (last - middle), last).

template<typename ExPolicy, typename FwdIter, typename Sent>
parallel::util::detail::algorithm_result<ExPolicy, subrange_t<FwdIter, Sent>>::type rotate(ExPolicy &&policy, FwdIter first, FwdIter middle, Sent 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 middle becomes the first element of the new range and middle - 1 becomes the last element.

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 an forward iterator.

  • Sent – The type of the end iterators used (deduced). This sentinel type must be a sentinel for FwdIter.

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.

  • middle – 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<subrange_t<FwdIter, Sent>> if the execution policy is of type parallel_task_policy and returns a subrange_t<FwdIter, Sent> otherwise. The rotate algorithm returns the iterator equal to pair(first + (last - middle), last).

template<typename Rng>
subrange_t<hpx::traits::range_iterator_t<Rng>, hpx::traits::range_iterator_t<Rng>> rotate(Rng &&rng, hpx::traits::range_iterator_t<Rng> middle)#

Uses rng as the source range, as if using util::begin(rng) as first and ranges::end(rng) as 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 middle becomes the first element of the new range and middle - 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

Rng – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of a forward iterator.

Parameters
  • rng – Refers to the sequence of elements the algorithm will be applied to.

  • middle – Refers to the element that should appear at the beginning of the rotated range.

Returns

The rotate algorithm returns a subrange_t<hpx::traits::range_iterator_t<Rng>, hpx::traits::range_iterator_t<Rng>>. The rotate algorithm returns the iterator equal to pair(first + (last - middle), last).

template<typename ExPolicy, typename Rng>
parallel::util::detail::algorithm_result<ExPolicy, subrange_t<hpx::traits::range_iterator_t<Rng>, hpx::traits::range_iterator_t<Rng>>>::type rotate(ExPolicy &&policy, Rng &&rng, hpx::traits::range_iterator_t<Rng> middle)#

Uses rng as the source range, as if using util::begin(rng) as first and ranges::end(rng) as 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 middle becomes the first element of the new range and middle - 1 becomes the last element.

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.

  • Rng – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of a forward 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.

  • middle – Refers to the element that should appear at the beginning of the rotated range.

Returns

The rotate algorithm returns a hpx::future <subrange_t<hpx::traits::range_iterator_t<Rng>, hpx::traits::range_iterator_t<Rng>>> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns subrange_t<hpx::traits::range_iterator_t<Rng>, hpx::traits::range_iterator_t<Rng>>. otherwise. The rotate algorithm returns the iterator equal to pair(first + (last - middle), last).

template<typename FwdIter, typename Sent, typename OutIter>
rotate_copy_result<FwdIter, OutIter> rotate_copy(FwdIter first, FwdIter middle, Sent 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 middle becomes the first element of the new range and middle - 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 an forward iterator.

  • Sent – The type of the end iterators used (deduced). This sentinel type must be a sentinel for FwdIter.

  • 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.

  • middle – 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 – Output iterator to the initial position of the range where the reversed range is stored. The pointed type shall support being assigned the value of an element in the range [first,last).

Returns

The rotate_copy algorithm returns a rotate_copy_result<FwdIter, OutIter>. The rotate_copy algorithm returns the output iterator to the element past the last element copied.

template<typename ExPolicy, typename FwdIter1, typename Sent, typename FwdIter2>
parallel::util::detail::algorithm_result<ExPolicy, rotate_copy_result<FwdIter1, FwdIter2>>::type rotate_copy(ExPolicy &&policy, FwdIter1 first, FwdIter1 middle, Sent 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 middle becomes the first element of the new range and middle - 1 becomes the last element.

The assignments in the parallel rotate_copy 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_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.

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 an forward iterator.

  • Sent – The type of the end iterators used (deduced). This sentinel type must be a sentinel for FwdIter.

  • FwdIter2 – The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an 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.

  • middle – 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 – Output iterator to the initial position of the range where the reversed range is stored. The pointed type shall support being assigned the value of an element in the range [first,last).

Returns

The rotate_copy algorithm returns areturns hpx::future< rotate_copy_result<FwdIter1, FwdIter2>> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns rotate_copy_result<FwdIter1, FwdIter2> otherwise. The rotate_copy algorithm returns the output iterator to the element past the last element copied.

template<typename Rng, typename OutIter>
rotate_copy_result<hpx::traits::range_iterator_t<Rng>, OutIter> rotate_copy(Rng &&rng, hpx::traits::range_iterator_t<Rng> middle, OutIter dest_first)#

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 dest_first in such a way, that the element middle becomes the first element of the new range and middle - 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
  • Rng – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of a forward iterator.

  • OutIter – The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an forward iterator.

Parameters
  • rng – Refers to the sequence of elements the algorithm will be applied to.

  • middle – Refers to the element that should appear at the beginning of the rotated range.

  • dest_first – Output iterator to the initial position of the range where the reversed range is stored. The pointed type shall support being assigned the value of an element in the range [first,last).

Returns

The rotate algorithm returns a rotate_copy_result<hpx::traits::range_iterator_t<Rng>, OutIter>. The rotate_copy algorithm returns the output iterator to the element past the last element copied.

template<typename ExPolicy, typename Rng, typename OutIter>
parallel::util::detail::algorithm_result<ExPolicy, rotate_copy_result<hpx::traits::range_iterator_t<Rng>, OutIter>>::type rotate_copy(ExPolicy &&policy, Rng &&rng, hpx::traits::range_iterator_t<Rng> middle, OutIter dest_first)#

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 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 invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.

The assignments in the parallel rotate_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.

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 forward iterator.

  • 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.

  • rng – Refers to the sequence of elements the algorithm will be applied to.

  • middle – Refers to the element that should appear at the beginning of the rotated range.

  • dest_first – Output iterator to the initial position of the range where the reversed range is stored. The pointed type shall support being assigned the value of an element in the range [first,last).

Returns

The rotate_copy algorithm returns a hpx::future<otate_copy_result< hpx::traits::range_iterator_t<Rng>, OutIter>> if the execution policy is of type parallel_task_policy and returns rotate_copy_result< hpx::traits::range_iterator_t<Rng>, OutIter> otherwise. The rotate_copy algorithm returns the output iterator to the element past the last element copied.