hpx::ranges::inplace_merge#
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 ExPolicy, typename Rng, typename Iter, typename Comp = hpx::ranges::less, typename Proj = hpx::identity>
hpx::parallel::util::detail::algorithm_result_t<ExPolicy, Iter> hpx::ranges::inplace_merge(ExPolicy &&policy, Rng &&rng, Iter middle, Comp &&comp = Comp(), Proj &&proj = Proj())# Merges two consecutive sorted ranges [first, middle) and [middle, last) into one sorted range [first, last). The order of equivalent elements in the each of original two ranges is preserved. For equivalent elements in the original two ranges, the elements from the first range precede the elements from the second range.
The assignments in the parallel inplace_merge algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.
The assignments in the parallel inplace_merge 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 O(std::distance(first, last)) applications of the comparison comp and the each projection.
- 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 an random access iterator.
Iter – The type of the source iterators used (deduced). This iterator type must meet the requirements of an random access iterator.
Comp – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of inplace_merge requires Comp to meet the requirements of CopyConstructible. This defaults to std::less<>
Proj – The type of an optional projection function. This defaults to hpx::identity
- Parameters:
policy – The execution policy to use for the scheduling of the iterations.
rng – Refers to the range of elements the algorithm will be applied to.
middle – Refers to the end of the first sorted range and the beginning of the second sorted range the algorithm will be applied to.
comp – comp is a callable object which returns true if the first argument is less than the second, and false otherwise. The signature of this comparison should be equivalent to:
The signature does not need to have const&, but the function must not modify the objects passed to it. The types Type1 and Type2 must be such that objects of types Iter can be dereferenced and then implicitly converted to both Type1 and Type2bool comp(const Type1 &a, const Type2 &b);
proj – Specifies the function (or function object) which will be invoked for each of the elements as a projection operation before the actual predicate is invoked.
- Returns:
The inplace_merge algorithm returns a hpx::future<Iter> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns Iter otherwise. The inplace_merge algorithm returns the source iterator last
-
template<typename ExPolicy, typename Iter, typename Sent, typename Comp = hpx::ranges::less, typename Proj = hpx::identity>
hpx::parallel::util::detail::algorithm_result_t<ExPolicy, Iter> hpx::ranges::inplace_merge(ExPolicy &&policy, Iter first, Iter middle, Sent last, Comp &&comp = Comp(), Proj &&proj = Proj())# Merges two consecutive sorted ranges [first, middle) and [middle, last) into one sorted range [first, last). The order of equivalent elements in the each of original two ranges is preserved. For equivalent elements in the original two ranges, the elements from the first range precede the elements from the second range.
The assignments in the parallel inplace_merge algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.
The assignments in the parallel inplace_merge 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 O(std::distance(first, last)) applications of the comparison comp and the each projection.
- 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.
Iter – The type of the source iterators used (deduced). This iterator type must meet the requirements of an random access iterator.
Sent – The type of the end source iterators used (deduced). This iterator type must meet the requirements of an sentinel for Iter1.
Comp – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of inplace_merge requires Comp to meet the requirements of CopyConstructible. This defaults to std::less<>
Proj – The type of an optional projection function. This defaults to hpx::identity
- Parameters:
policy – The execution policy to use for the scheduling of the iterations.
first – Refers to the beginning of the first sorted range the algorithm will be applied to.
middle – Refers to the end of the first sorted range and the beginning of the second sorted range the algorithm will be applied to.
last – Refers to the end of the second sorted range the algorithm will be applied to.
comp – comp is a callable object which returns true if the first argument is less than the second, and false otherwise. The signature of this comparison should be equivalent to:
The signature does not need to have const&, but the function must not modify the objects passed to it. The types Type1 and Type2 must be such that objects of types Iter can be dereferenced and then implicitly converted to both Type1 and Type2bool comp(const Type1 &a, const Type2 &b);
proj – Specifies the function (or function object) which will be invoked for each of the elements as a projection operation before the actual predicate is invoked.
- Returns:
The inplace_merge algorithm returns a hpx::future<Iter> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns Iter otherwise. The inplace_merge algorithm returns the source iterator last
-
template<typename Rng, typename Iter, typename Comp = hpx::ranges::less, typename Proj = hpx::identity>
Iter hpx::ranges::inplace_merge(Rng &&rng, Iter middle, Comp &&comp = Comp(), Proj &&proj = Proj())# Merges two consecutive sorted ranges [first, middle) and [middle, last) into one sorted range [first, last). The order of equivalent elements in the each of original two ranges is preserved. For equivalent elements in the original two ranges, the elements from the first range precede the elements from the second range.
Note
Complexity: Performs O(std::distance(first, last)) applications of the comparison comp and the each projection.
- Template Parameters:
Rng – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an random access iterator.
Iter – The type of the source iterators used (deduced). This iterator type must meet the requirements of an random access iterator.
Comp – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of inplace_merge requires Comp to meet the requirements of CopyConstructible. This defaults to std::less<>
Proj – The type of an optional projection function. This defaults to hpx::identity
- Parameters:
rng – Refers to the range of elements the algorithm will be applied to.
middle – Refers to the end of the first sorted range and the beginning of the second sorted range the algorithm will be applied to.
comp – comp is a callable object which returns true if the first argument is less than the second, and false otherwise. The signature of this comparison should be equivalent to:
The signature does not need to have const&, but the function must not modify the objects passed to it. The types Type1 and Type2 must be such that objects of types Iter can be dereferenced and then implicitly converted to both Type1 and Type2bool comp(const Type1 &a, const Type2 &b);
proj – Specifies the function (or function object) which will be invoked for each of the elements as a projection operation before the actual predicate is invoked.
- Returns:
The inplace_merge algorithm returns Iter. The inplace_merge algorithm returns the source iterator last
-
template<typename Iter, typename Sent, typename Comp = hpx::ranges::less, typename Proj = hpx::identity>
Iter hpx::ranges::inplace_merge(Iter first, Iter middle, Sent last, Comp &&comp = Comp(), Proj &&proj = Proj())# Merges two consecutive sorted ranges [first, middle) and [middle, last) into one sorted range [first, last). The order of equivalent elements in the each of original two ranges is preserved. For equivalent elements in the original two ranges, the elements from the first range precede the elements from the second range.
Note
Complexity: Performs O(std::distance(first, last)) applications of the comparison comp and the each projection.
- Template Parameters:
Iter – The type of the source iterators used (deduced). This iterator type must meet the requirements of an random access iterator.
Sent – The type of the end source iterators used (deduced). This iterator type must meet the requirements of an sentinel for Iter1.
Comp – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of inplace_merge requires Comp to meet the requirements of CopyConstructible. This defaults to std::less<>
Proj – The type of an optional projection function. This defaults to hpx::identity
- Parameters:
first – Refers to the beginning of the first sorted range the algorithm will be applied to.
middle – Refers to the end of the first sorted range and the beginning of the second sorted range the algorithm will be applied to.
last – Refers to the end of the second sorted range the algorithm will be applied to.
comp – comp is a callable object which returns true if the first argument is less than the second, and false otherwise. The signature of this comparison should be equivalent to:
The signature does not need to have const&, but the function must not modify the objects passed to it. The types Type1 and Type2 must be such that objects of types Iter can be dereferenced and then implicitly converted to both Type1 and Type2bool comp(const Type1 &a, const Type2 &b);
proj – Specifies the function (or function object) which will be invoked for each of the elements as a projection operation before the actual predicate is invoked.
- Returns:
The inplace_merge algorithm Iter. The inplace_merge algorithm returns the source iterator last