fork download
  1. template <typename T>
  2. inline T const& max (T const& a, T const& b)
  3. {
  4. return (a < b) ? (b) : (a);
  5. }
  6.  
  7. int main()
  8. {
  9. ::max("apples","peaches");
  10. }
  11.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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]’)
stdout
Standard output is empty