Or for the extremists...
T delegate(T a) acc(T)(T i){
struct Foo {
T a;
T func(T x) { return a += x; }
}
return &(cast(Foo*)((&i)[0..1]).dup).func;
}
or...
T delegate(T a) acc(T)(T i){
struct Foo {
T a;
T func(T x) { return a += x; }
}
return &(cast(Foo*)((new T[1])[] = i)).func;
}
--
Tomasz Stachowiak /+ a.k.a. h3r3tic +/