One more about mixins
Max Samukha
samukha at voliacable.com.removethis
Sun Aug 24 23:27:46 PDT 2008
On Sun, 24 Aug 2008 19:21:54 -0400, Tomasz Sowi?ski
<tomeksowi at gmail.com> wrote:
>
>I tried using a string[] as an argument instead of a variadic argument, but still it doesn't work.
I think you tried to pass separate strings to the non-variadic
version. The following works:
string intGen(string[] names)
{
string result;
foreach (name; names)
result ~= "int " ~ name ~ "; ";
return result;
}
struct tag {
mixin(intGen(["aa", "bb", "cc"]));
}
void main()
{
writefln(tag.tupleof.stringof);
// tuple((tag).aa,(tag).bb,(tag).cc)
}
More information about the Digitalmars-d-learn
mailing list