fork download
  1. #include <iostream>
  2. #include <iostream>
  3. template <typename T>
  4. T max(T x, T y)
  5. {
  6. return x > y ? x : y;
  7. }
  8.  
  9. int main()
  10. {
  11. //std::cout<<::max(3,4.7)<<"\n"; //Error
  12. std::cout<<::max<int>(3,4.7)<<"\n"; //Error
  13. std::cout<<::max<double>(3,4.7)<<"\n"; //Works
  14. }
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
4
4.7