11 Algorithms library [algorithms]

11.5 Sorting and related operations [alg.sorting]

11.5.6 Heap operations [alg.heap.operations]

11.5.6.2 pop_heap [pop.heap]

template <RandomAccessIterator I, Sentinel<I> S, class Comp = less<>, class Proj = identity> requires Sortable<I, Comp, Proj> I pop_heap(I first, S last, Comp comp = Comp{}, Proj proj = Proj{}); template <RandomAccessRange Rng, class Comp = less<>, class Proj = identity> requires Sortable<iterator_t<Rng>, Comp, Proj> safe_iterator_t<Rng> pop_heap(Rng&& rng, Comp comp = Comp{}, Proj proj = Proj{});

Requires: The range [first,last) shall be a valid non-empty heap.

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

Returns: last

Complexity: At most 2 * log(last - first) applications of the comparison function and projection.