On 09/23/2011 08:47 PM, Gor F. Gyolchanyan wrote:
Of course, if the entire D gets CTFE-able, the __ctfe will be completely 
useless.
But i can't see that coming for a long time. Most of the major programming
problems are best solved with classes and that's where CTFE stops.

About templates:

void unpackIntoFunction(alias arrayOfVariants, alias func)()
{
    // you can't generate the necessary mixin strings right here, because it 
won't
be compile-time.
    // you need to create a separate function, that returns the required string 
to
be mixed in.
    mixin(whatIJustGenerated);
}


mixin({
    string r;
    foreach(i; 0..10) r~=q{writeln("hello world!");};
    return r;
}());

Reply via email to