Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library User's Guide

3.3 Predicates

A predicate is simply a function object that returns a value convertible to a bool. Here is an example of a predicate, which takes an integer as argument and returns true if the number represents a leap year, and false otherwise:

A predicate is used as an argument, for example, in the generic algorithm named std::find_if(). This algorithm returns the first value that satisfies the predicate, returning the end-of-range value if no such element is found. Using this algorithm, the following locates the first leap year in a list of years:



Previous fileTop of DocumentContentsIndex pageNext file