I am trying to pass a std :: function using a method like this:
class dispatch { public: deliver( std::function<void ( void )> task ); }
This works as expected. However, I want to pass arguments to some of the methods set as a task, but would prefer not to create overloads for all the various functions <...>.
for example, itβs generally possible to just create a method like the following
deliver( std::function& task );
and just call
dispatch->deliver( bind( &Object::method, X ) );
or
dispatch->deliver( bind( &Object::method, X, arg1, arg2 ) );
etc...
Thanks for every contribution. It would seem that my real mistake is sending calls -> deliver with an additional argument, which is also a binding call.
dispatch->deliver( bind( &Object::method1, X1, bind( &Object::method1, X2 ) );
error: / usr / include / C ++ / v1 / functional: 1539: 13: error: there is no corresponding function to call '__mu_expand' return __mu_expand (__ ti, __uj, __indices ());
Corvusoft
source share