
4 Mar
2009
4 Mar
'09
11:55 a.m.
Hi, I've recently been making more use of boost::bind, and I coded the following, which I thought would work: class A { public: void reset () {} }; typedef std::map<int, boost::shared_ptr<A> > map_type; map_type m; std::for_each (m.begin(), m.end(), boost::bind(&A::reset, 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(&A::reset, boost::bind(&boost::shared_ptr<A>::get, 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). -- Kevin