d coder Wrote:

> > Ah.. Now I think I understand.
> >
> > This new code I have written will all be run at compile time. So in
> > this case, the foreach statement inside the constructor would be
> > reduced to a bunch of writeln statements at compile time and those
> > writeln would be executed at the run time. This will not happen with
> > the actual code since there are other typeof and is statements in
> > there that can not be run at runtime.

Yes, but the if statement will also be there so the code would look something 
like:

if(true)
    writeln(...)

if(false)
    writeln(...)
...

> If I got it right now, It will be possible for me to unroll the
> foreach loop and the if statements in a mixin and that would work
> well.
> Or may be changing the "if" statement to "static if" would do the
> trick. I will give it a try.

Static if must be done so that invalid code is not generated. As for another 
part of what you want. Use std.range.ElementType so that you can get the type 
you wish to call new for:

           this.tupleof[i][j] = new ElementType!(this.tupleof[i])();

Reply via email to