Newbie initial comments on D language - delegate
BCS
ao at pathlink.com
Mon Jan 28 22:09:48 PST 2008
Reply to Russell,
> what I did was just generate a template which automatically created a
> delegate out of it.
>
somthing like this?
// IFTI might want somthing else\ here
R delegate(A) convert(R, A...)(R function(A) fnp)
{
struct S
{
// "this" is a function pointer not a S*
R do(A a) { U u; u.s = this; retrun s.f(a);}
}
union U
{
S* s;
R function(a) f;
}
U u;
u.f= fnp;
retrun &u.s.do;
}
note it never news anything!
*Untested, but I've used the idea befor.*
More information about the Digitalmars-d
mailing list