digitalmars.D - Passing a Delegate as Parameter
- Joshua Cearley (11/11) Feb 22 2005 I am trying to make a Signal/Slot system (the kind that Qt uses) for a
- Russ Lewis (7/21) Feb 22 2005 void foo(int delegate(char,float,double) arg) { ... }
I am trying to make a Signal/Slot system (the kind that Qt uses) for a library I am creating (currently named Crystal Widgets Toolkit) which Currently, I've run in to one problem. How would I pass a delegate as a function parameter? I tried aliasing but that only gives me awkward errors. I don't have the source code at the moment and I'm about to go to bed so I can't give the specific error. Any help would be gladly appreciated. -Joshua Cearley BlackCrystal Software "Making dreams reality"
Feb 22 2005
void foo(int delegate(char,float,double) arg) { ... } Note the difference between the way that you declare a delegate type, which is: <retval> delegate(<args>) and the way that you declare a delegate literal, which is: delegate <retval>(<args>) { <code> } Joshua Cearley wrote:I am trying to make a Signal/Slot system (the kind that Qt uses) for a library I am creating (currently named Crystal Widgets Toolkit) which Currently, I've run in to one problem. How would I pass a delegate as a function parameter? I tried aliasing but that only gives me awkward errors. I don't have the source code at the moment and I'm about to go to bed so I can't give the specific error. Any help would be gladly appreciated. -Joshua Cearley BlackCrystal Software "Making dreams reality"
Feb 22 2005