template specialization question

Ellery Newcomer ellery-newcomer at utulsa.edu
Sun Jan 31 11:50:07 PST 2010


I haven't gotten around to templates yet, so I don't grok them quite as 
well as I'd like, but it looks like DMD is having trouble deducing T 
from the parameter given.

print([1,2,3]) fails to match the specialized template, even when the 
general template is removed.

If you force the template parameter, it does what you would expect:


	print!(int)(3);
	print!(int[3])([1,2,3]);


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

Can't say whether this belongs in bugzilla or not. It might.

On 01/31/2010 12:49 PM, daoryn wrote:

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



More information about the Digitalmars-d-learn mailing list