[ create a new paste ] login | about

Link: http://codepad.org/l6rByNk1    [ raw code | output | fork ]

C++, pasted on May 5:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>

template <typename T>
T max(T x, T y)
{
return x > y ? x : y;
}

int main()
{
cout<<::max<int>(4,4.8)<<"\n";
cout<<::max<double>(3,4.7)<<"\n";
}


Output:
1
2
3
cc1plus: warnings being treated as errors
In function 'int main()':
Line 11: warning: passing 'double' for argument 2 to 'T max(T, T) [with T = int]'


Create a new paste based on this one


Comments: