The difference between the rules and calling the function template with common functions

Difference between function template with common functions, and the rules

Difference: ordinary function implicit type conversion parameter, not a template;
call rules: (1) C ++ Compiler priority normal function;
(2) via the argument list may be empty template (<>) is defined only by template matching;
(3) as a function of the template may be overridden as a normal function;
(4) If the template can produce a better match, then the preference template;
limitations template and solutions :
template can not solve all the data types, such as subjects of between operations.
Solution: In particular template; template <> bool Sort (Person & a);
the difference between class template function template:
(1) class template can be a default type, the function template not;
(2) class template is not automatic type derivation function templates can; (class templates need to show the type of call)

Published 38 original articles · won praise 13 · views 4320

Guess you like

Origin blog.csdn.net/YanWenCheng_/article/details/104012987