vc6.0 STL generic template max () and min () can not use the C2065 error solution

Use VC ++ 6.0 STL were tested generic template function max () and min () error
test:

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	cout<<max(3,4)<<endl;
	cout<<min(19,33)<<endl;
	return 0;
}

The results given:

error C2065: 'max' : undeclared identifier
error C2065: 'min' : undeclared identifier

Solution:
VC6.0, by default, the max () modified into _cpp_max (), min () Similarly, so when we () max will be written by an error, we reverse thinking as long as the max () and min () instead _cpp_max () and _cpp_min () on the line

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	cout<<_cpp_max(3,4)<<endl;
	cout<<_cpp_min(19,33)<<endl;
	return 0;
}

Output:

4
19
Press any key to continue

Guess you like

Origin blog.csdn.net/qq_41767945/article/details/90708119