No dynamic Arrays in Struct?

Jarrett Billingsley kb3ctd2 at yahoo.com
Sat Feb 10 17:18:14 PST 2007


"Chris Nicholson-Sauls" <ibisbasenji at gmail.com> wrote in message 
news:eql1r2$a2f$1 at digitaldaemon.com...
> Manfred Nowak wrote:
>> torhu wrote
>>> You can't have an assignment in the struct definition.
>>
>> Oooops. Thank you. I was misleaded by the error message.
>>
>> -manfred
>
> Try
> struct S {
>   int[] map = new int[1000];
> }
>
> /Should/ work I believe, if you really want the length dynamic.

You can't have non-static initializers for aggregate member declarations. 
That's one thing I wish D would take from Java/C#... 




More information about the Digitalmars-d-learn mailing list