Template alias parameter does not accept types

ref2401 refactor24 at gmail.com
Thu May 9 03:58:57 PDT 2013


Version D 2.062
http://dlang.org/template.html#TemplateAliasParameter
Is is said in the documentation that is's possible but i get 
compile time error.

template GetString(alias Arg)
{
	enum string GetString = Arg.stringof;
}

void main(string[] argv)
{
	writeln(GetString!"1234");
	writeln(GetString!18);
	
	writeln(GetString!int); // Error: template instance 
GetString!(int)
				// GetString!(int) does not match template
				// declaration GetString(alias Arg)
	
	readln();
}


More information about the Digitalmars-d-learn mailing list