how to pass a variable name in the template in this case?

Zhenya zheny at list.ru
Thu Aug 2 15:04:24 PDT 2012


module main;

import std.stdio;

immutable double f = 0;

template T(alias a)
{
	auto T = a;
}

int main(string[] argv)
{
	char f = 'a';
	writeln(typeid(T!f));//deduce f as 'a'
	readln();
	return 0;
}



More information about the Digitalmars-d-learn mailing list