As one example, assume that we want to print the
vector after we call
elimDups (§ 10.2.3, p. 384). However, we’ll also assume that we want to see the words ordered by their size, and then alphabetically within each size. To reorder the
vector by length, we’ll use a second, overloaded version of
sort. This version of
sort takes a third argument that is a predicate.
A predicate is an expression that can be called and that returns a value that can be used as a condition. The predicates used by library algorithms are either unary predicates (meaning they have a single parameter) or binary predicates ...