According to http://digitalmars.com/d/2.0/template.html it is possible to 
specify template specialization so that DMD prefers them when instanciating 
templates, however the following code:


---------------------------------
import std.stdio;

void print(T)(T thing)
{
        writeln("Calling print(T)");
        writeln(T.stringof);
}

void print(T:T[])(T[] things)
{
        writeln("Calling print(T[])");
        writeln(T.stringof);
}

void main()
{
        print(3);
        print([1,2,3]);
}

-----------------------------------------

will output:

Calling print(T)
int
Calling print(T)
int[3u]

I expected it to output "calling print(T[])" on the second "print". Would this 
be a bug or did I misunderstand the template specialization?

Reply via email to