Pass template parameter into q{} string

Kagamin spam at here.lot
Mon Apr 8 12:11:51 UTC 2019


Maybe just use mixin template?

mixin template f(alias values)
{
     static foreach(v;values)
         mixin("bool " ~ v ~ " = false;");
}
int main()
{
     enum string[] a=["a","b"];
     mixin f!a;
     return 0;
}


More information about the Digitalmars-d-learn mailing list