Boost logo

Boost Users :

Subject: [Boost-users] boost::bind used with boost shared_ptr
From: Kevin Ludwig (kevin.ludwig_at_[hidden])
Date: 2009-03-04 13:55:21


I've recently been making more use of boost::bind, and I coded the
following, which I thought would work:

class A {
    void reset () {}
typedef std::map<int, boost::shared_ptr<A> > map_type;
map_type m;
std::for_each (m.begin(), m.end(),
    boost::bind(&map_type::value_type::second, _1)));

but fails to compile. Next I tried this:

std::for_each (m.begin(), m.end(),
    boost::bind(&map_type::value_type::second, _1))));

Which works and is fine (I guess). I just wonder why the first syntax is
not supported? boost::shared_ptr is supposed to behave like a pointer (and
here it seems that it does not).


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at