On Thursday, 2 August 2012 at 22:36:34 UTC, Andrej Mitrovic wrote:
On 8/3/12, Zhenya <zh...@list.ru> wrote:
snip
You mean how to extract the variable name?
import std.stdio;
template T(alias a)
{
enum string T = __traits(identifier, a);
}
void main(string[] argv)
{
char f = 'a';
writeln(T!f); // writes 'f'
}
Huh,thank you,I understood.I just thought that by default alias
parameter is an identifier.I was surprised then I saw that
possible to pass value of variable,which is'nt enum.Could you
explain me why it is?