Node:Sorting and related operations, Next:Generalized numeric operations, Previous:Mutating sequence operations, Up:Algorithms
Compare and one that uses an operator<.
Compare is a function object which returns a value convertible to
bool.
Compare comp is used throughout for algorithms assuming an ordering
relation. comp satisfies the standard axioms for total ordering and
it does not apply any non-constant function through the dereferenced
iterator. For all algorithms that take Compare,
there is a version that uses operator< instead.
That is, comp(*i, *j) == true defaults to
*i < *j == true.
A sequence is sorted with respect to a comparator comp if for any
iterator i pointing to an element in a sequence and any non-negative
integer n such that
i + n is a valid iterator pointing to an element of
the same sequence, comp(*(i + n), *i) == false.
In the descriptions of the functions that deal with ordering
relationships we frequently use a notion of equality to describe concepts
such as stability. The equality to which we refer is not necessarily an
operator==, but an equality relation induced by the total ordering.
That is, two element a and b are considered equal
if and only if !(a < b) && !(b < a).