
Sergey Lukin wrote:
Jeff Flinn wrote:
The types above are incompatible, use what Peter suggested previously:
boost::function<void()> f = boost::bind( DPC::Print1, &x, 2 );
I tried this also - no effect whatsoever.
Have you tried to compile my code ?
You are right, the code doesn't work because Component::Method1 is a template. Something like typedef boost::function< void() > handler_type; handler_type handler = boost::bind( &DPC::Print1, &x, 2 ); async_wait( boost::bind( &Component::Method1<handler_type>, &y, 10, handler ) ); should work, but doesn't, under MSVC 7.1 at least. MSVC 8.0 eats it, though. typedef boost::function< void() > handler_type; handler_type handler = boost::bind( &DPC::Print1, &x, 2 ); void (Component::*pmf) (int, handler_type) = &Component::Method1; async_wait( boost::bind( pmf, &y, 10, handler ) ); works under MSVC 7.1, but is too unwieldy.