template argument inference : for function templates, the compiler uses function arguments in calls to determine template parameters, and the process of determining template parameters from function arguments is called template argument inference.
Type conversions and template type parameters
As always, the top-level const is ignored either in the formal parameter or in the argument.
Const Conversion: You can pass a reference (or pointer) of a non-const object to a const reference (or pointer) parameter.
• Array or function pointer conversions: An array argument can be converted to a pointer to its first element. Similarly, a function argument can be scratched to convert a pointer to the function type.
1Template <typename t> t fobj (t, T)//The actual argument is copied2Template <typename t> T fret (ConstT&,Constt&)//References3 4 stringS1 ("a value");5 ConstSTRNG S2 ("another value");6Fobj (s1, S2);//call Fobj (String, string); Const is ignored7Fret (s1, S2);//Call fret (const string&, const string&); const is ignored8 9 inta[Ten], b[ the];TenFobj (A, b);//Call Fobj (int*, int*); OneFret (A, b);//Error
"C + + Primer the 16th chapter" 2. Template argument Inference