Parameterized type problem.. WT.. [c++]?

template<typename T>

T const& max (T const& a, T const& b)

{

return a<b?b:a;

}

int g = max(1, 1.0);

I am trying to find meaning of this Holy sentence "The deduction process compares the types of an argument of a function call with the corresponding parameterized type of a function template and attempts to conclude the correct substitution for one or more of the *deduced parameters*. Each argument-parameter pair is analyzed independently, and if the conclusions differ in the end, the deduction process fails"

Can anyone please please please explain the above sentence step wise as sentence goes? specially : what is -> parameterized type of a function template and how it is compared with type of call argument ?

The problem is not coding itself actually , i understanding everything and what author means to say overall but it's just i am trying to figure out meaning of every sentence and word to understand the whole perfectly and exactly.

P.S: I am gone mad or author has used some superfluous words?

Update:

but shouldn't standard have wrote something like : "Template argument deduction is done by comparing each **function's** template parameter type with the type of the corresponding argument of the call" ?or i am still not getting the word **function template parameter type** which means function template's call parameter's type ?

Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Helpful Social

Copyright © 2024 QUIZLS.COM - All rights reserved.