weird behavior returning delegate
kris
foo at bar.com
Mon Jul 3 11:07:43 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;
> }
>
>
>
Instead of the "cast(Foo*)", can you do a ".ptr" ?
More information about the Digitalmars-d
mailing list