I'm following the pluralsight C++ course, and in it is the following code:
#include <iostream>
template <class T>
T max(T& t1, T& t2)
{
return t1 < t2 ? t2 : t1;
}
int main()
{
std::cout << "Max of 33 and 44 is " << max(33, 44) << std::endl;
return 0;
}
I typed over this piece of code, but unlike the code of the course, I get an error message:
C2664: 'max' : cannot convert parameter 1 from 'int' to 'int &'
The code in the course is written in Visual Studio Express 2010, while mine is written in Visual Studio Ultimate 2010.
EDIT
Thanks to everybody (even Kate Gregory herself) for providing answers and clearing everything up.