Thanks so much, Kevin and John, for your patience with this self proclaimed member of the "newbie ignoramus" species :^D I am very glad I decided to immerse myself in this daunting language, C++, which is most likely the most complex programming language ever devised. I had been avoiding it for years. The availability of Boost has been a main factor in my decision to program in C++ from now on. Best regards, -Ramon Kevin Kassil wrote:
So you say that the callback is really not required?
Hi Ramon,
The STL for_each [1] accepts a "unary function object" [2] which offers more flexibility than a simple non-member function. For example (off the top of my head) [3]:
Class myClass; for_each( begin, end, boost::bind( & Class::function, &myClass _1 ));
I also point out that if you wanted to, you could replace for_each with your own for loop. (Not that you need to.)
1. http://www.sgi.com/tech/stl/for_each.html
2. http://www.sgi.com/tech/stl/functors.html
3. http://www.boost.org/doc/libs/1_40_0/libs/bind/bind.html#with_algorithms
HTH,
Kevin