Introduction to OOP | Chapter 20: The STL : | next | previous | audio | real | text |
Objects can take arguments computed at run-time, specialize functions in a way that simple functions cannot:
class biggerThan { public: biggerThan (int x) : testValue(x) { } const int testValue; bool operator () (int val) { return val > testValue; } }; list<int>::iterator firstBig = find_if (aList.begin(), aList.end(), biggerThan(12));