
17 Jul
2009
17 Jul
'09
12:47 p.m.
2009/7/17 Robert Jones <robertgbjones@gmail.com>
struct A { void a(); }; type std::vector<boost::shared_ptr<A> > VecType; VecType v;
for (VecType::iterator i=v.begin(); i != v.end(); ++i ) (*i)->a();
How can I write that as a for_each loop?
std::for_each(v.begin(), v.end(), boost::mem_fn(&A::a)); Roman Perepelitsa.