hpx::make_heap#

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

Functions

template<typename ExPolicy, typename RndIter, typename Comp>
hpx::parallel::util::detail::algorithm_result_t<ExPolicy> make_heap(ExPolicy &&policy, RndIter first, RndIter last, Comp &&comp)#

Constructs a max heap in the range [first, last). Executed according to the policy.

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.

  • RndIter – The type of the source iterators used for algorithm. This iterator must meet the requirements for a random access iterator.

  • Comp – Comparison function object (i.e. an object that satisfies the requirements of Compare) which returns true if the first argument is less than the second. The signature of the comparison function should be equivalent to the following:

    bool cmp(const Type1 &a, const Type2 &b);
    
    While the signature does not need to have const &, the function must not modify the objects passed to it and must be able to accept all values of type (possibly const) Type1 and Type2 regardless of value category (thus, Type1 & is not allowed, nor is Type1 unless for Type1 a move is equivalent to a copy. The types Type1 and Type2 must be such that an object of type RandomIt can be dereferenced and then implicitly converted to both of them.

Parameters
  • policy – The execution policy to use for the scheduling of the iterations.

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

  • last – Refers to the end of the sequence of elements of that 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.

Returns

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

template<typename ExPolicy, typename RndIter>
hpx::parallel::util::detail::algorithm_result_t<ExPolicy> make_heap(ExPolicy &&policy, RndIter first, RndIter last)#

Constructs a max heap in the range [first, last). Uses the operator < for comparisons. Executed according to the policy.

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.

  • RndIter – The type of the source iterators used for algorithm. This iterator must meet the requirements for a random access iterator.

Parameters
  • policy – The execution policy to use for the scheduling of the iterations.

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

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

Returns

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

template<typename RndIter, typename Comp>
void make_heap(RndIter first, RndIter last, Comp &&comp)#

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

Note

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

Template Parameters
  • RndIter – The type of the source iterators used for algorithm. This iterator must meet the requirements for a random access iterator.

  • Comp – Comparison function object (i.e. an object that satisfies the requirements of Compare) which returns true if the first argument is less than the second. The signature of the comparison function should be equivalent to the following:

    bool cmp(const Type1 &a, const Type2 &b);
    
    While the signature does not need to have const &, the function must not modify the objects passed to it and must be able to accept all values of type (possibly const) Type1 and Type2 regardless of value category (thus, Type1 & is not allowed, nor is Type1 unless for Type1 a move is equivalent to a copy. The types Type1 and Type2 must be such that an object of type RandomIt can be dereferenced and then implicitly converted to both of them.

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

  • last – Refers to the end of the sequence of elements of that 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.

Returns

The make_heap algorithm returns a void.

template<typename RndIter>
void make_heap(RndIter first, RndIter last)#

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

Note

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

Template Parameters

RndIter – The type of the source iterators used for algorithm. This iterator must meet the requirements for a random access iterator.

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

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

Returns

The make_heap algorithm returns a void.