这行在小型测试程序中正常工作,但在我想要它的程序中,我得到以下编译器投诉:
#include <limits>
x = std::numeric_limits<int>::max();
c:\...\x.cpp(192) : warning C4003: not enough actual parameters for macro 'max'
c:\...\x.cpp(192) : error C2589: '(' : illegal token on right side of '::'
c:\...\x.cpp(192) : error C2059: syntax error : '::'
Run Code Online (Sandbox Code Playgroud)
我得到了相同的结果:
#include <limits>
using namespace std;
x = numeric_limits<int>::max();
Run Code Online (Sandbox Code Playgroud)
为什么它将max视为宏max(a,b); ?
我怎么去实际调用std :: max?代码将无法在visual studio 2013中编译,因为它将"max"作为宏.
std::max( ... );
Run Code Online (Sandbox Code Playgroud)
预期"std ::"之后的标识符.