Templates array detection

bearophile bearophileHUGS at lycos.com
Wed Dec 12 14:25:49 PST 2012


ixid:

> It seems very similar to a function overload to me. Why is 
> picking T[] in preference to T different to picking uint over 
> ulong for an overloaded function used on a uint?

The name T can refer to any type, including a U[], while built-in 
types like uint are atomic, they can't refer to a composed type.
And there is difference between a built-in type where both the 
programmer and the compiler know about, and generic user defined 
types. And template types are used in an exact way, unlike 
function overloading they don't perform implicit type conversions.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list