template <typename T>
inline T const& max (T const& a, T const& b)
{
return (a < b) ? (b) : (a);
}
int main()
{
::max("apples","peaches");
}
dGVtcGxhdGUgPHR5cGVuYW1lIFQ+CmlubGluZSBUIGNvbnN0JiBtYXggKFQgY29uc3QmIGEsIFQgY29uc3QmIGIpCnsKICAgIHJldHVybiAgKGEgPCBiKSAgPyAgKGIpIDogKGEpOwp9CgppbnQgbWFpbigpCnsKICAgIDo6bWF4KCJhcHBsZXMiLCJwZWFjaGVzIik7Cn0K
prog.cpp: In function ‘int main()’:
prog.cpp:9:29: error: no matching function for call to ‘max(const char [7], const char [8])’
prog.cpp:9:29: note: candidate is:
prog.cpp:2:17: note: template<class T> const T& max(const T&, const T&)
prog.cpp:2:17: note: template argument deduction/substitution failed:
prog.cpp:9:29: note: deduced conflicting types for parameter ‘const T’ (‘char [7]’ and ‘char [8]’)