The standard library defines two template functions Std::min () and Std::max () in the <algorithm> header. It is usually used to calculate the minimum and maximum values for a pair of values.
Unfortunately, they are not available in Visual C + + because these function templates are not defined. The reason is that the name min and Max conflict with the traditional Min/max macro definition in <windows.h>. To address this problem, Visual C + + defines two other templates with the same functionality: _cpp_min () and _cpp_max (). We can use them instead of std::min () and Std::max ().
In order to disable the Min/max macro definition in Visual C + +, you can add the following before including the <windows.h> header file:
Or add Nominmax to the preprocessor difinitions. The specific methods are:
Visual C + + 6.0: Open a project file (*.DSW) or (*.DSP), select the project you want to define, enter the menu "project" => "Settings" (Open the Settings dialog) => the "Setting for" in the upper left corner Select "All Configurations" in the Drop-down list box, and then select the "C + +" tab => Add "Nominmax" to the preprocessor difinitions edit box.
Visual C + + 7.0: Open the project file (*.sln) or (*.vcproj), select the project to define, enter the menu "project" => "Properties" (Open Project Properties dialog box) => in the upper-left corner of the configuration drop-down list box, select all configurations. Then, in the property configuration on the left, select the => "C + +" => "preprocessor" => right "preprocessor definition" to add "Nominmax".