Boost logo

Boost Users :

Subject: [Boost-users] Using vectors of ptrs
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2009-07-17 08:40:55


Hi All

Here's a quickie for you....

Given

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?

for_each( v.begin(), v.end(), boost::bind( ????? ) );

Thanks,

- Rob.

ps I can't use lambda because boost.bind is already used, and the
placeholder name
collisions just aren't worth the pain.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net