weird behavior returning delegate
John Reimer
terminal.node at gmail.com
Mon Jul 3 11:13:47 PDT 2006
Tom S wrote:
> 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;
> }
>
>
>
Bad, Tom. You've been playing with templates again, haven't you? ;)
-JJR
More information about the Digitalmars-d
mailing list