HPX - High Performance ParalleX

PrevUpHomeNext

Function template swap_ranges

hpx::parallel::v1::swap_ranges

Synopsis

// In header: <hpx/parallel/detail/swap_ranges.hpp>


template<typename ExPolicy, typename ForwardIter1, typename ForwardIter2> 
  unspecified swap_ranges(ExPolicy && policy, ForwardIter1 first1, 
                          ForwardIter1 last1, ForwardIter2 first2);

Description

Exchanges elements between range [first1, last1) and another range starting at first2.

[Note] Note

Complexity: Linear in the distance between first1 and last1

The swap operations in the parallel swap_ranges algorithm invoked with an execution policy object of type sequential_execution_policy execute in sequential order in the calling thread.

The swap operations in the parallel swap_ranges algorithm invoked with an execution policy object of type parallel_execution_policy or task_execution_policy are permitted to execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each thread.

Parameters:

first1

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

first2

Refers to the beginning of the second sequence of elements the algorithm will be applied to.

last1

Refers to the end of the first sequence of elements the algorithm will be applied to.

policy

The execution policy to use for the scheduling of the iterations.

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 swap operations.

ForwardIter1

The type of the first range of iterators to swap (deduced). This iterator type must meet the requirements of an forward iterator.

ForwardIter2

The type of the second range of iterators to swap (deduced). This iterator type must meet the requirements of an forward iterator.

Returns:

The swap_ranges algorithm returns a hpx::future<ForwardIter2> if the execution policy is of type task_execution_policy and returns ForwardIter2 otherwise. The swap_ranges algorithm returns iterator to the element past the last element exchanged in the range beginning with first2.


PrevUpHomeNext