stringof of an TemplateAliasParameter

Matthias Walter Matthias.Walter at
Sun May 18 12:33:35 PDT 2008


suppose you have the following template:

| template Foo (alias X)
| {
|   const char[] Foo = X.stringof ~ " = null;";
| }

... and instanciate it with a struct member ...

| mixin (Foo !(mystruct.member));

... this code becomes "member = null;", although I'd like it to be "mystruct.member = null;" Is this intended behavior? .stringof seems to return only sort of a short version of the name.

Of course I could make my template accept a string "mystruct.member" instead of an alias to make it work, but I thought this would be more comfortable to let the user call my mixins with variables instead of strings, containing variables! Or is there another way to achieve my needs?

best regards
Matthias Walter

More information about the Digitalmars-d-learn mailing list