hpx/parallel/container_algorithms/make_heap.hpp#

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx

Top-level namespace.

namespace ranges

Functions

template<typename ExPolicy, typename Iter, typename Sent, typename Comp, typename Proj = hpx::parallel::util::projection_identity>
hpx::parallel::util::detail::algorithm_result<ExPolicy, Iter>::type make_heap(ExPolicy &&policy, Iter first, Sent last, Comp &&comp, Proj &&proj = Proj{})#

Constructs a max heap in the range [first, last).

The predicate operations in the parallel make_heap algorithm invoked with an execution policy object of type sequential_execution_policy executes in sequential order in the calling thread.

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

Note

Complexity: at most (3*N) comparisons where N = distance(first, last).

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 begin source iterators used (deduced). This iterator type must meet the requirements of an forward 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).

  • Proj – The type of an optional projection function. This defaults to util::projection_identity

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.

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

  • comp – Refers to the binary predicate which returns true if the first argument should be treated as less than the second. The signature of the function should be equivalent to

    bool comp(const Type &a, const Type &b);
    
    The signature does not need to have const &, but the function must not modify the objects passed to it. The type Type must be such that objects of types RndIter can be dereferenced and then implicitly converted to Type.

  • proj – Specifies the function (or function object) which will be invoked for each pair of elements as a projection operation before the actual predicate comp is invoked.

Returns

The make_heap algorithm returns a hpx::future<Iter> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns Iter otherwise. It returns last.

template<typename ExPolicy, typename Rng, typename Comp, typename Proj = hpx::parallel::util::projection_identity>
hpx::parallel::util::detail::algorithm_result<ExPolicy, typename hpx::traits::range_iterator<Rng>::type>::type make_heap(ExPolicy &&policy, Rng &&rng, Comp &&comp, Proj &&proj = Proj{})#

Constructs a max heap in the range [first, last).

The predicate operations in the parallel make_heap algorithm invoked with an execution policy object of type sequential_execution_policy executes in sequential order in the calling thread.

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

Note

Complexity: at most (3*N) comparisons where N = distance(first, last).

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

  • Comp – The type of the function/function object to use (deduced).

  • Proj – The type of an optional projection function. This defaults to util::projection_identity

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.

  • comp – Refers to the binary predicate which returns true if the first argument should be treated as less than the second. The signature of the function should be equivalent to

    bool comp(const Type &a, const Type &b);
    
    The signature does not need to have const &, but the function must not modify the objects passed to it. The type Type must be such that objects of types RndIter can be dereferenced and then implicitly converted to Type.

  • proj – Specifies the function (or function object) which will be invoked for each pair of elements as a projection operation before the actual predicate comp is invoked.

Returns

The make_heap algorithm returns a hpx::future<Iter> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns Iter otherwise. It returns last.

template<typename ExPolicy, typename Iter, typename Sent, typename Proj = hpx::parallel::util::projection_identity>
hpx::parallel::util::detail::algorithm_result<ExPolicy, Iter>::type make_heap(ExPolicy &&policy, Iter first, Sent last, Proj &&proj = Proj{})#

Constructs a max heap in the range [first, last).

The predicate operations in the parallel make_heap algorithm invoked with an execution policy object of type sequential_execution_policy executes in sequential order in the calling thread.

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

Note

Complexity: at most (3*N) comparisons where N = distance(first, last).

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 begin source iterators used (deduced). This iterator type must meet the requirements of an forward iterator.

  • Sent – The type of the end source iterators used (deduced). This iterator type must meet the requirements of an sentinel for Iter1.

  • Proj – The type of an optional projection function. This defaults to util::projection_identity

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.

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

  • proj – Specifies the function (or function object) which will be invoked for each pair of elements as a projection operation before the actual predicate comp is invoked.

Returns

The make_heap algorithm returns a hpx::future<Iter> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns Iter otherwise. It returns last.

template<typename ExPolicy, typename Rng, typename Proj = hpx::parallel::util::projection_identity>
hpx::parallel::util::detail::algorithm_result<ExPolicy, typename hpx::traits::range_iterator<Rng>::type>::type make_heap(ExPolicy &&policy, Rng &&rng, Proj &&proj = Proj{})#

Constructs a max heap in the range [first, last).

The predicate operations in the parallel make_heap algorithm invoked with an execution policy object of type sequential_execution_policy executes in sequential order in the calling thread.

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

Note

Complexity: at most (3*N) comparisons where N = distance(first, last).

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

  • Proj – The type of an optional projection function. This defaults to util::projection_identity

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.

  • proj – Specifies the function (or function object) which will be invoked for each pair of elements as a projection operation before the actual predicate comp is invoked.

Returns

The make_heap algorithm returns a hpx::future<Iter> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns Iter otherwise. It returns last.

template<typename Iter, typename Sent, typename Comp, typename Proj = hpx::parallel::util::projection_identity>
Iter make_heap(Iter first, Sent last, Comp &&comp, Proj &&proj = Proj{})#

Constructs a max heap in the range [first, last).

Note

Complexity: at most (3*N) comparisons where N = distance(first, last).

Template Parameters
  • Iter – The type of the begin source iterators used (deduced). This iterator type must meet the requirements of an forward 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).

  • Proj – The type of an optional projection function. This defaults to util::projection_identity

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

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

  • comp – Refers to the binary predicate which returns true if the first argument should be treated as less than the second. The signature of the function should be equivalent to

    bool comp(const Type &a, const Type &b);
    
    The signature does not need to have const &, but the function must not modify the objects passed to it. The type Type must be such that objects of types RndIter can be dereferenced and then implicitly converted to Type.

  • proj – Specifies the function (or function object) which will be invoked for each pair of elements as a projection operation before the actual predicate comp is invoked.

Returns

The make_heap algorithm returns Iter. It returns last.

template<typename Rng, typename Comp, typename Proj = hpx::parallel::util::projection_identity>
hpx::traits::range_iterator<Rng>::type make_heap(Rng &&rng, Comp &&comp, Proj &&proj = Proj{})#

Constructs a max heap in the range [first, last).

Note

Complexity: at most (3*N) comparisons where N = distance(first, last).

Template Parameters
  • Rng – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an input iterator.

  • Comp – The type of the function/function object to use (deduced).

  • Proj – The type of an optional projection function. This defaults to util::projection_identity

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

  • comp – Refers to the binary predicate which returns true if the first argument should be treated as less than the second. The signature of the function should be equivalent to

    bool comp(const Type &a, const Type &b);
    
    The signature does not need to have const &, but the function must not modify the objects passed to it. The type Type must be such that objects of types RndIter can be dereferenced and then implicitly converted to Type.

  • proj – Specifies the function (or function object) which will be invoked for each pair of elements as a projection operation before the actual predicate comp is invoked.

Returns

The make_heap algorithm returns Iter. It returns last.

template<typename Iter, typename Sent, typename Proj = hpx::parallel::util::projection_identity>
Iter make_heap(Iter first, Sent last, Proj &&proj = Proj{})#

Constructs a max heap in the range [first, last).

Note

Complexity: at most (3*N) comparisons where N = distance(first, last).

Template Parameters
  • Iter – The type of the begin source iterators used (deduced). This iterator type must meet the requirements of an forward iterator.

  • Sent – The type of the end source iterators used (deduced). This iterator type must meet the requirements of an sentinel for Iter1.

  • Proj – The type of an optional projection function. This defaults to util::projection_identity

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

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

  • proj – Specifies the function (or function object) which will be invoked for each pair of elements as a projection operation before the actual predicate comp is invoked.

Returns

The make_heap algorithm returns Iter. It returns last.

template<typename Rng, typename Proj = hpx::parallel::util::projection_identity>
hpx::traits::range_iterator<Rng>::type make_heap(Rng &&rng, Proj &&proj = Proj{})#

Constructs a max heap in the range [first, last).

Note

Complexity: at most (3*N) comparisons where N = distance(first, last).

Template Parameters
  • Rng – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an input iterator.

  • Proj – The type of an optional projection function. This defaults to util::projection_identity

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

  • proj – Specifies the function (or function object) which will be invoked for each pair of elements as a projection operation before the actual predicate comp is invoked.

Returns

The make_heap algorithm returns Iter. It returns last.