Standard C++ Library Reference ISO/IEC (VERSION3)
pred(*(first + N)) is true, and for each N in the range [K, last - first) the
predicate pred(*(first + N)) is false. The function then returns first + K.
The predicate must not alter its operand. The function evaluates pred(*(first + N))
exactly last - first times, and swaps at most (last - first) / 2 pairs of elements.
pop_heap
template<class RanIt>
void pop_heap(RanIt first, RanIt last);
template<class RanIt, class Pr>
void pop_heap(RanIt first, RanIt last, Pr pred);
The first template function reorders the sequence designated by iterators in the range [first,
last) to form a new heap, ordered by operator< and designated by iterators in the range
[first, last - 1), leaving the original element at *first subsequently at *(last -
1). The original sequence must designate an existing heap, also ordered by operator<. Thus,
first != last must be true and *(last - 1) is the element to remove from (pop off)
the heap.
The function evaluates the ordering predicate X < Y at most ceil(2 * log(last -
first)) times.
The second template function behaves the same, except that it replaces operator<(X, Y)
with pred(X, Y).
prev_permutation
template<class BidIt>
bool prev_permutation(BidIt first, BidIt last);
template<class BidIt, class Pr>
bool prev_permutation(BidIt first, BidIt last,
Pr pred);
The first template function determines a repeating sequence of permutations, whose initial
permutation occurs when the sequence designated by iterators in the range [first, last) is
the reverse of one ordered by operator<. (The elements are sorted in descending order.) It
then reorders the elements in the sequence, by evaluating swap(X, Y) for the elements X and
Y zero or more times, to form the previous permutation. The function returns true only if the
resulting sequence is not the initial permutation. Otherwise, the resultant sequence is the one next
smaller lexicographically than the original sequence. No two elements may have equivalent
ordering.
The function evaluates swap(X, Y) at most (last - first) / 2.
The second template function behaves the same, except that it replaces operator<(X, Y)