25 Algorithms library [algorithms]

25.5 Sorting and related operations [alg.sorting]

25.5.6 Heap operations [alg.heap.operations]

25.5.6.2 pop_heap [pop.heap]

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

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

Effects: Swaps the value in the location first with the value in the location last - 1 and makes [first, last - 1) into a heap.

Complexity: At most 2 log(last - first) comparisons.