Sorry for the fuzzy name, feel free to edit it if you find a better one. A related topic was deeply discussed in Priority between the normal function and the Template function , but I did not find the answer to my question.
My code is:
template<typename T> void f(T t){std::cout << "Template 1" << std::endl;}
What is the possible reason that the function of template 1 is called on line 1? Is it well defined in the specification?
On line 1, I think the compiler should give a "ambiguous overload" error.
c ++ overloading templates
Zhongkun Ma
source share