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
namespace ranges

Functions

template<typename ExPolicy, typename Rng, typename Comp, typename Proj = util::projection_identity>
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.
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
  • 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.

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.

Return

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 = util::projection_identity>
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). Uses the operator < for comparisons.

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

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.

Return

The make_heap algorithm returns a hpx::future<void> if the execution policy is of type task_execution_policy and returns void otherwise.