Hi,
Could anybody point me what is wrong wth this code. I get the following compiler error -
ambiguous call to overloaded function
1> c:\documents and settings\rsisondi\my documents\visual studio 2005\projects\templatefunction\templatefunction\templatefunction.cpp(14): could be 'const T &max<std::string>(const T &,const T &)'
1> with
1> [
1> T=std::string
1> ]
However Code works If I don't pass strings to max function.
It works if I comment
"std::string s3 = max(s1,s2);" line.
The compiler can't decide whether to use yours or the standard one for std::string. You can force it to use yours with ::max or the standard one std::max.
I'll look into it further when I have a bit more time.