Introduction to OOP Chapter 19: Container Classes : next previous audio real text

The Visitor in C++ in the STL

class printingObject {
	void operator () (int x) 
		cout << "value is " << x << endl;

printingObject printer;  // create an instance of the function object

for_each (aList.begin(), aList.end(), printer);
The function for_each passes the object to element element in the collection.
Intro OOP, Chapter 19, Slide 19