casting array literals doesn't work as stated in the docs

Trass3r mrmocool at gmx.de
Sun Jan 3 02:53:20 PST 2010


Trass3r schrieb:
>  Any reason for defining the behavior like that?
> 

I mean converting an array to an array of structs doesn't make sense as 
soon as you have multiple struct members cause

cast(Foo[])[0,1,2,3,4] gets rewritten as
[cast(Foo) 0, cast(Foo) 1, cast(Foo) 2, cast(Foo) 3, cast(Foo) 4]
which becomes
[Foo(0), Foo(1), Foo(2), Foo(3), Foo(4)]

if I didn't miss anything.



More information about the Digitalmars-d mailing list