18 Feb
2005
18 Feb
'05
11:06 p.m.
Delfin Rojas wrote:
I guess I had not done my homework all the way. I found a way to make bll::bind work when the placeholder is a shared_ptr by dereferencing it. In other words,
std::for_each(vpFoos2.begin(),vpFoos2.end(), boost::lambda::bind(&CFoo::SetI, *boost::lambda::_1, 5));
While this solves most of my problems I still cannot make it work for this other case:
shared_ptr<CFoo> pFoo(new CFoo); std::vector<int> vnValues(10, 1); std::for_each(vnValues.begin(), vnValues.end(), boost::lambda::bind(&CFoo::SetI, pFoo, boost::lambda::_1));
I tried dereferencing pFoo but it didn't work.
pFoo.get() should work. ref(*pFoo) or var(*pFoo) might also work.