25 Algorithms library [algorithms]

25.4 Sorting and related operations [alg.sorting]

25.4.6 Heap operations [alg.heap.operations]

25.4.6.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);

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

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

Complexity: At most N log(N) comparisons (where N == last - first).