static code generation
js.mdnq
js_adddot+mdng at gmail.com
Sun Dec 9 02:42:39 PST 2012
How can I create mixes of stringified code and code itself?
http://dlang.org/mixin.html
explains how to create structs using strings. But what if I do
not want to have to encode the whole struct as a string but only
parts of it?
mixin template GenStruct(stringname)
{
struct stringname ~ "alpha"
{
....
}
}
mixin GenStruct!("Helpme");
would be equivalent to do the following
struct Helpmealpha
{
....
}
More information about the Digitalmars-d-learn
mailing list