LargerThan tester(12);
LargerThan tester(12);
int i = ... ;
if (tester(i)) // true if i is larger than 12
A temporary object can be created by simply naming the class and any arguments to the constructor.
list<int>::iterator found =find_if (aList.begin(), aList.end(), LargerThan(12));
Previous slide
Next slide
Back to first slide
View graphic version