16 Apr
2009
16 Apr
'09
11:21 a.m.
Hello, Is it possible somehow to make a binder that stores "unexpected" argument? Motivation: I have to create & pass a callback handler from within intusively ref-counted object (MS-ATL) to an outer asynchronous subsystem. If the object were shared-ptr enabled, I'd do this as usually: ThisObj::handler() { //... } ThisObj::doSomething() { asyncSubsystem_->doSomething(&ThisObj::handler, shared_from_this()); } However, in my case I have to do something like this: asyncSubsystem_->doSomething(&ThisObj::handler, this, mySmartPtr); // store someOtherSmartPtr in the functor, just to ensure "this" won't die before the handler is invoked Is it possible with bind, lambda or some other library? Thanks.