P
param
Hi guys,
The following code is not being compiled. I am getting this error
message:
C:\Dev-Cpp\tmp2Params.cpp In function `T1 maxx(const T1&, const T2&)
[with T1 = int, T2 = double]':
12 C:\Dev-Cpp\tmp2Params.cpp instantiated from here
7 C:\Dev-Cpp\tmp2Params.cpp [Warning] converting to `int' from
`double'
Any idea, what i am missing here. i am purposly passing the arguments
as int and double i.e. (4,5.5 ).The compiler is Dev C++.
#include <iostream>
using namespace std;
template <class T1, class T2 >
T2 maxx (T1 const& a, T2 const& b)
{
return a > b ? a:b;
}
int main( int argc, char ** argv)
{
cout << " Max: " << maxx(4, 5.5) << endl;
getchar();
}
The following code is not being compiled. I am getting this error
message:
C:\Dev-Cpp\tmp2Params.cpp In function `T1 maxx(const T1&, const T2&)
[with T1 = int, T2 = double]':
12 C:\Dev-Cpp\tmp2Params.cpp instantiated from here
7 C:\Dev-Cpp\tmp2Params.cpp [Warning] converting to `int' from
`double'
Any idea, what i am missing here. i am purposly passing the arguments
as int and double i.e. (4,5.5 ).The compiler is Dev C++.
#include <iostream>
using namespace std;
template <class T1, class T2 >
T2 maxx (T1 const& a, T2 const& b)
{
return a > b ? a:b;
}
int main( int argc, char ** argv)
{
cout << " Max: " << maxx(4, 5.5) << endl;
getchar();
}