11 Algorithms library [algorithms]

11.5 Sorting and related operations [alg.sorting]

11.5.6 Heap operations [alg.heap.operations]

11.5.6.1 push_heap [push.heap]

template <RandomAccessIterator I, Sentinel<I> S, class Comp = less<>, class Proj = identity> requires Sortable<I, Comp, Proj> I push_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> push_heap(Rng&& rng, Comp comp = Comp{}, Proj proj = Proj{});

Effects: Places the value in the location last - 1 into the resulting heap [first,last).

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

Returns: last

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