Name
make_heap function template — Reorders a range to convert it into a heap
Synopsis
template<typename RandIter> void make_heap(RandIter first, RandIter last); template<typename RandIter, typename Compare> void make_heap(RandIter first, RandIter last, Compare comp);
The make_heap
function
template reorders the elements in the range [first
, last
) to form a heap in place.
The first form compares values using the <
operator. The second form calls
comp(*iter
, value)
.
Technical Notes
Postcondition: [first, last) is a heap.
Complexity is linear: at most, 3 × (last - first) comparisons are performed.
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.