Function Objects
class LargerThan {public: // constructor LargerThan (int v) { val = v; } // the function call operator bool operator () (int test) { return test > val; }private: int val;
LargerThan tester(12); // create the predicate function
list<int>::iterator found =find_if (aList.begin(), aList.end(), tester);
if (found != aList.end())printf("element is %d", *found); // found such a value
elseprintf("no element larger than 12");