std.intrinsic and structs

Jaheera no at spam.com
Fri Nov 30 12:31:57 PST 2007


"Chad J" <gamerChad at _spamIsBad_gmail.com> wrote in message 
news:fipmho$ivc$1 at digitalmars.com...
> Jaheera wrote:
>>
>> I also have a question about structs.
>>
>> I want to do this, but this obviously doesn't work:
>>
>> struct foo(int var)
>> {
>>     int[var] x;
>> }
>>
>> struct bar
>> {
>>     foo[4] zeb(10);
>> }
>>
>> Thanks.
>
> I /think/ what you want is this:
>
> struct foo(int var)
> {
>   int[var] x; // static array of 'var' elements
> }
>
> struct bar
> {
>   /* static array of 4 elements containing foos that contain static arrays 
> of 10 elements. */
>   foo!(10)[4] zeb;
> }
>
> I'm sorry I don't know if I'm actually helping.  I don't entirely 
> understand the question.

Actually you understood it perfectly, this appears to be exactly what i 
needed, thanks! 




More information about the Digitalmars-d-learn mailing list