On Sunday, 9 December 2012 at 19:09:49 UTC, anonymous wrote:
On Sunday, 9 December 2012 at 10:42:40 UTC, js.mdnq wrote:
How can I create mixes of stringified code and code itself?
[...]
mixin template GenStruct(stringname)
{
    struct stringname ~ "alpha"
    {
        ....
    }
}


mixin GenStruct!("Helpme");

would be equivalent to do the following

struct Helpmealpha
{
   ....
}

In this particular case you can do this:
mixin template GenStruct(string stringname)
{
     struct S
     {
         ....
     }
     mixin("alias S " ~ stringname ~ "alpha;");
}

But what if I use more than one mixin? I'll have multiple structs
with the same name.

Reply via email to