String mixins with string arrays

Mike James foo at bar.com
Fri Dec 13 03:40:33 PST 2013


Hi,

Is it possible to pass a string array to a string mixin e.g

template GenSomething(string foo, string[] bar){
   some_kind_of_foreach(br: bar) {
     const char[] foo ~ br ~ ";\n";
   }
}

and call:

mixin(GenSomething!("A", ["B", "C", "D"]));

would generate:

A.B;
A.C;
A.D;

Regards,

-=mike=-


More information about the Digitalmars-d-learn mailing list