On 09/06/2011 12:36 AM, zeljkog wrote:
On 05.09.2011 23:06, Timon Gehr wrote:

The aggregate to loop over is evaluated at compile time:

int[] getAggregate(){return [1,2,3,];}
static foreach(x;getAggregate()) {
pragma(msg,x);
}


Eh :)
For me the only compile time agregate is tuple.

foreach already works with any aggregate at compile time.

int[] getAggregate(){return [1,2,3,];}
mixin({
    string r;
    foreach(x;getAggregate()) r~="pragma(msg,"~to!string(x)~");";
    return r;
}());

What is your point?


We should talk about basic looping construct for compile time evolution.


In CTFE you can use any looping construct you like.

Reply via email to