static code generation

js.mdnq js_adddot+mdng at gmail.com
Sun Dec 9 11:00:17 PST 2012


On Sunday, 9 December 2012 at 11:25:25 UTC, Philippe Sigaud wrote:
> 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));
> }

If I'm not mistaken isn't the "code" I'm trying to generate still 
in a string?

(you've unfortunately left out the most important part at 
`//build your code here`)




More information about the Digitalmars-d-learn mailing list