
30 Dec
2009
30 Dec
'09
9:13 a.m.
Another strange behavior: struct Functor { void func1() const {} }; int main() { boost::shared_ptr<Functor> pf1; Functor *pf2; boost::function<void(void)> f1 = boost::bind(&Functor::func1, pf1); // boost.bind with shared_ptr and store in function - OK boost::lambda::bind(&Functor::func1, pf1); // labmda bind with shared_ptr - OK boost::function<void(void)> f2 = boost::lambda::bind(&Functor::func1, pf2); // lambda bind with regular ptr and store in function - OK boost::function<void(void)> f3 = boost::lambda::bind(&Functor::func1, pf1); // lambda bind with shared_ptr and store in function - FAILS } Phoenix behaves the same way.