hpx::ranges::swap_ranges
hpx::ranges::swap_ranges#
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
-
namespace ranges
Functions
-
template<typename InIter1, typename Sent1, typename InIter2, typename Sent2>
swap_ranges_result<InIter1, InIter2> swap_ranges(InIter1 first1, Sent1 last1, InIter2 first2, Sent2 last2)# Exchanges elements between range [first1, last1) and another range starting at first2.
The swap operations in the parallel swap_ranges algorithm invoked without an execution policy object execute in sequential order in the calling thread.
Note
Complexity: Linear in the distance between first1 and last1
- Template Parameters
InIter1 – The type of the first range of iterators to swap (deduced).
Sent1 – The type of the first sentinel (deduced). This sentinel type must be a sentinel for InIter1.
InIter2 – The type of the second range of iterators to swap (deduced).
Sent2 – The type of the second sentinel (deduced). This sentinel type must be a sentinel for InIter2.
- Parameters
first1 – Refers to the beginning of the sequence of elements for the first range.
last1 – Refers to sentinel value denoting the end of the sequence of elements for the first range.
first2 – Refers to the beginning of the sequence of elements for the second range.
last2 – Refers to sentinel value denoting the end of the sequence of elements for the second range.
- Returns
The swap_ranges algorithm returns swap_ranges_result<InIter1, InIter2>. The swap_ranges algorithm returns in_in_result with the first element as the iterator to the element past the last element exchanged in range beginning with first1 and the second element as the iterator to the element past the last element exchanged in the range beginning with first2.
-
template<typename ExPolicy, typename FwdIter1, typename Sent1, typename FwdIter2, typename Sent2>
parallel::util::detail::algorithm_result<ExPolicy, swap_ranges_result<FwdIter1, FwdIter2>>::type swap_ranges(ExPolicy &&policy, FwdIter1 first1, Sent1 last1, FwdIter2 first2, Sent2 last2)# Exchanges elements between range [first1, last1) and another range starting at first2.
The swap operations in the parallel swap_ranges algorithm invoked with an execution policy object of type sequenced_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_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 first1 and last1
- 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 first range of iterators to swap (deduced).
Sent1 – The type of the first sentinel (deduced). This sentinel type must be a sentinel for FwdIter1.
FwdIter2 – The type of the second range of iterators to swap (deduced).
Sent2 – The type of the second sentinel (deduced). This sentinel type must be a sentinel for FwdIter2.
- Parameters
policy – The execution policy to use for the scheduling of the iterations.
first1 – Refers to the beginning of the sequence of elements for the first range.
last1 – Refers to sentinel value denoting the end of the sequence of elements for the first range.
first2 – Refers to the beginning of the sequence of elements for the second range.
last2 – Refers to sentinel value denoting the end of the sequence of elements for the second range.
- Returns
The swap_ranges algorithm returns a hpx::future<swap_ranges_result<FwdIter1, FwdIter2>> if the execution policy is of type parallel_task_policy and returns FwdIter2 otherwise. The swap_ranges algorithm returns in_in_result with the first element as the iterator to the element past the last element exchanged in range beginning with first1 and the second element as the iterator to the element past the last element exchanged in the range beginning with first2.
-
template<typename Rng1, typename Rng2>
swap_ranges_result<hpx::traits::range_iterator_t<Rng1>, hpx::traits::range_iterator_t<Rng2>> swap_ranges(Rng1 &&rng1, Rng2 &&rng2)# Exchanges elements between range [first1, last1) and another range starting at first2.
The swap operations in the parallel swap_ranges algorithm invoked without an execution policy object execute in sequential order in the calling thread.
Note
Complexity: Linear in the distance between first1 and last1
- Template Parameters
Rng1 – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an input iterator.
Rng2 – The type of the destination range used (deduced). The iterators extracted from this range type must meet the requirements of an input iterator.
- Parameters
rng1 – Refers to the sequence of elements of the first range.
rng2 – Refers to the sequence of elements of the second range.
- Returns
The swap_ranges algorithm returns swap_ranges_result< hpx::traits::range_iterator_t<Rng1>, hpx::traits::range_iterator_t<Rng1>>. The swap_ranges algorithm returns in_in_result with the first element as the iterator to the element past the last element exchanged in range beginning with first1 and the second element as the iterator to the element past the last element exchanged in the range beginning with first2.
-
template<typename ExPolicy, typename Rng1, typename Rng2>
parallel::util::detail::algorithm_result<ExPolicy, swap_ranges_result<hpx::traits::range_iterator_t<Rng1>, hpx::traits::range_iterator_t<Rng2>>> swap_ranges(ExPolicy &&policy, Rng1 &&rng1, Rng2 &&rng2)# Exchanges elements between range [first1, last1) and another range starting at first2.
The swap operations in the parallel swap_ranges algorithm invoked with an execution policy object of type sequenced_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_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 first1 and last1
- 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.
Rng1 – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an input iterator.
Rng2 – The type of the destination range used (deduced). The iterators extracted from this range type must meet the requirements of an input iterator.
- Parameters
policy – The execution policy to use for the scheduling of the iterations.
rng1 – Refers to the sequence of elements of the first range.
rng2 – Refers to the sequence of elements of the second range.
- Returns
The swap_ranges algorithm returns a hpx::future<swap_ranges_result< hpx::traits::range_iterator_t<Rng1>, hpx::traits::range_iterator_t<Rng1>>> if the execution policy is of type parallel_task_policy and returns swap_ranges_result< hpx::traits::range_iterator_t<Rng1>, hpx::traits::range_iterator_t<Rng1>>. otherwise. The swap_ranges algorithm returns in_in_result with the first element as the iterator to the element past the last element exchanged in range beginning with first1 and the second element as the iterator to the element past the last element exchanged in the range beginning with first2.
-
template<typename InIter1, typename Sent1, typename InIter2, typename Sent2>
-
namespace ranges