std::sort_heap() algorithm
- od C++20
- do C++20
template< class RandomIt >
constexpr void sort_heap( RandomIt first, RandomIt last );
// (2)
template< class RandomIt, class Compare >
constexpr void sort_heap( RandomIt first, RandomIt last, Compare comp );
template< class RandomIt >
void sort_heap( RandomIt first, RandomIt last );
// (2)
template< class RandomIt, class Compare >
void sort_heap( RandomIt first, RandomIt last, Compare comp );
Converts the max heap [first
; last
) into a sorted range in ascending order.
The resulting range no longer has the heap property.
-
(1) Elements are compared using
operator<
. -
(2) Elements are compared using the given binary comparison function
comp
.
Parameters
first last | The range of elements to sort. |
policy | The execution policy to use. See execution policy for details. |
comp | Comparison function object (i.e. an object that satisfies the requirements of Compare). The signature of the comparison function should be equivalent to the following:
|