D's limited template specialization abilities compared to C++

Peter Alexander peter.alexander.au at gmail.com
Sat May 25 04:44:51 PDT 2013


Is this what you're looking for?

struct Foo(T)
{
	static void bar() { writeln("general"); }
}

struct Foo(T : A[B], A, B)
{
	static void bar() { writeln("special"); }
}

void main()
{
	Foo!(int).bar(); // general
	Foo!(int[int]).bar(); // special
}


More information about the Digitalmars-d mailing list