std.intrinsic and structs

Chad J gamerChad at _spamIsBad_gmail.com
Fri Nov 30 10:59:08 PST 2007


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.


More information about the Digitalmars-d-learn mailing list