
8 Feb
2006
8 Feb
'06
9:22 p.m.
Sergey Lukin wrote:
But when I try to perform indirect call of Print1 from Method1 which is called by a timer compiler reports a lot of bugs in the boost::bind code (see part of the log) t.async_wait(boost::bind(boost::bind(Component::Method1, &y, 10, boost::bind (DPC::Print1, &x, 2)), &t)); or t.async_wait(boost::bind(Component::Method1, &y, 10, boost::bind (DPC::Print1, &x, 2), &t));
You need to prevent the inner bind from being treated as a subexpression of the outer bind. Either assign it to a function<>: boost::function<void()> f = boost::bind( DPC::Print1, &x, 2 ); t.async_wait( boost::bind( Component::Method1, &y, 10, f ) ); or use boost::protect, as explained at the end of http://boost.org/libs/bind/bind.html#nested_binds