28 Algorithms library [algorithms]

28.7 Sorting and related operations [alg.sorting]

28.7.7 Heap operations [alg.heap.operations]

28.7.7.4 sort_­heap [sort.heap]

template<class RandomAccessIterator> void sort_heap(RandomAccessIterator first, RandomAccessIterator last); template<class RandomAccessIterator, class Compare> void sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);

Requires: The range [first, last) shall be a valid heap. RandomAccessIterator shall satisfy the requirements of ValueSwappable. The type of *first shall satisfy the requirements of MoveConstructible and of MoveAssignable.

Effects: Sorts elements in the heap [first, last).

Complexity: At most NlogN comparisons, where N=last - first.