// Maximum of two int values <br/> inline int const & MAX (INT const & A, int const & B) <br/>{< br/> return a <B? B:; <br/>}</P> <p> // maximum of two values of any type <br/> template <typename T> <br/> inline t const & MAX (t const &, t const & B) <br/>{< br/> return a <B? B: A; <br/>}< br/>/* <br/> if other conditions are the same for non-template functions and function templates with the same name, during the call, the reload parsing process <br/> usually calls non-template functions, instead of generating an instance from the template. <Br/> */<br/> // maximum of three values of any type <br/> template <typename T> <br/> inline t const & MAX (T const &, t const & B, T const & C) <br/>{< br/> return: max (a, B), c ); <br/>}</P> <p> int main () <br/> {<br/>: max (7, 42, 68 ); // callthe template for three arguments <br/>: max (7.0, 42.0); // callmax <double> (by argument deduction) <br/> :: max ('A', 'B'); // callmax <char> (by argument deduction) <br/>: max (7, 42 ); // callthe nontemplate for two ints <br/>: max <> (7, 42); // callmax <int> (by argument deduction) <br/> // explicitly specify an empty list of real parameters for the template. This syntax tells the compiler that only the template can match the call. <br/> :: max <double> (7, 42); // callmax <double> (no argument deduction) <br/>: max ('A', 42.7 ); // callthe nontemplate for two ints <br/> // The template does not allow automatic type conversion, but normal functions can perform automatic type conversion, therefore, a non-template function will be called <br/>}< br/>