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 a notion of equality is frequently used to describe concepts such as stability. The equality referred to, 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).
|
|