我遇到了问题std::max.我无法弄清楚.
int border = 35;
int myInt = 2;
int myOtherInt = 3;
int z = std::max(myInt + 2 * border, myOtherInt + 2 * border);
Run Code Online (Sandbox Code Playgroud)
我已经包含了算法标准头.当我鼠标移动到最大值时,我得到:
错误:期望标识符
并编译错误:
错误C2589 ::错误C2059
'('右侧的非法令牌'::'
:语法错误:'::'
怎么了?
template <class T>
struct scalar_log_minimum {
public:
typedef T value_type;
typedef T result_type;
static
result_type initial_value(){
return std::log(std::numeric_limits<result_type>::max());
}
static
void update(result_type& t, const value_type& x){
if ( (x>0) && (std::log(x)<t) ) t = std::log(x);
}
};
Run Code Online (Sandbox Code Playgroud)
我在尝试编译上面时遇到以下错误:
functional_ext.hpp:55:59:宏"max"需要2个参数,但只有1个给定
max不是宏,对吧?那么这个错误是什么?顺便说一下,我正在使用visual studio 2005
55:59 --- 55是59号线?