static code generation

Philippe Sigaud philippe.sigaud at gmail.com
Sun Dec 9 03:25:11 PST 2012


You can use a templated string-returning function and mix it in:


string codeGenerator(compileTimeArguments, Other...)(Other others)
{
     string result = ...
    (...) // build your code here
     return result;
}

(...)

class C
{
     mixin(codeGenerator!(args)(1, 2, 3));
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20121209/75978c31/attachment.html>


More information about the Digitalmars-d-learn mailing list