
On Fri, Feb 29, 2008 at 6:08 AM, QbProg <tholag@gmail.com> wrote:
[snip]
function <void (int , int ) > FunctionOne; function < bool (int ) > FunctionTwo;
class Implementor { public: void ImplOne ( int , int ); bool ImplTwo ( int ); };
void test () { Implementor i;
FunctionOne = bind ( &Implementor::ImplOne , &i , _1 , _ 2); FunctionTwo = bind (&Implemenetor::ImplTwo, &i , _1);
/* I Would be nice to do something like this, with parameter "guessing" */ // FunctionOne = GenericBind ( &Implementor::ImplOne ,&i); // FunctionTwo = GenericBind ( &Implementor::ImplTwo, &i);
/* This will greatly remove verbosity! */ /* Actually I do */ #define Bind0(A,B) bind(A,B) #define Bind1(A,B) bind(A,B,_1) #define Bind2(A,B) bind(A,B,_1,_2) ...... FunctionOne = Bind2 ( &Implementor::ImplOne , &i ); FunctionTwo = Bind1 ( &Implementor::ImplTwo , &i); }
It would be usefoul to make library callbacks more usable, insteat of writing a long list of arguments each time. It is possible with current implementation?
I have something in the dataflow library that I am planning to take in the direction you're suggesting. The current syntax allows something like this: FunctionOne = make_slot_selector<void (int, int)> ( &Implementor::ImplOne , i ); FunctionTwo = make_slot_selector<bool (int)>( &Implementor::ImplTwo , &i); So it's not (yet) quite what you're looking for, but when the member function is not overloaded I don't think I need the signature to be specified explicitly, and can provide something like FunctionOne = make_slot_selector( &Implementor::ImplOne , i ); But I haven't had time to try it yet :-) I was going to try to do one last push this weekend to get this lib submitted for review, maybe as a part of that effort I can give this a whirl. Stjepan