Function templates do implicit conversions for their arguments

TommiT tommitissari at hotmail.com
Thu Jul 4 14:31:42 PDT 2013


On Thursday, 4 July 2013 at 20:43:45 UTC, Maxim Fomin wrote:
>
> Implementation may do other way, at first instantiate template 
> (with deduced type) and then try to plug arguments as in case 
> of non-template function (including implicit conversion). If it 
> cannot, implementation issues error message for a particular 
> problem and then general "template error instantiation".

Well, it doesn't really matter how it is implemented. What 
matters is that the implicit conversion does happen.


> What are your points regarding type deduction and implicit 
> conversion in D?

I thought my point would have been made painstakingly clear by 
now. My point is that D behaves in a way that's very different 
from C++ or any other language which does heterogeneous 
translation of type parameters. And I've never seen any mention 
of this neither in the spec nor in TDPL (nor have I seen this 
discussed before). This difference should be mentioned somewhere 
newcomers are guaranteed to see it.


More information about the Digitalmars-d mailing list