boost::function to member function - "changing the instance of the class".

After i define a boost::function using bind to a member function of some
signature...
Can i change the instance to have as "this" in such function for another of
the same type? Maybe pass it as a parameter at call time?
Why would i want that?
Imagine i have some class A that dispatches calls for a big amount of
methods. The requests for such calls come serialized, and the method is
selected by its name (string).
So there should be a std::map

On Thu, Aug 7, 2008 at 2:51 PM, Alejandro Martinez
After i define a boost::function using bind to a member function of some signature...
Can i change the instance to have as "this" in such function for another of the same type? Maybe pass it as a parameter at call time?
Thanks a lot for your time :)
Try boost::bind(&YourClass::YourMethod, _1, <rest of parameters>) That will create a boost::function whose first parameter will be used as 'this' in hte method call. HTH Stuart Dootson

thank you
participants (2)
-
Alejandro Martinez
-
Stuart Dootson