相关疑难解决方法(0)

std :: min给出了错误

#include <algorithm>
#include <Windows.h>

int main()
{
    int k = std::min(3, 4);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

什么是Windows正在做,如果我包括Windows.h我不能在Visual Studio 2005中使用std :: min.错误消息是:

error C2589: '(' : illegal token on right side of '::'
error C2059: syntax error : '::'
Run Code Online (Sandbox Code Playgroud)

c++ visual-studio-2005

99
推荐指数
6
解决办法
5万
查看次数

abs vs std :: abs,引用说什么?

当心,我在说::abs(),不是std::abs()

根据cplusplus.com网站,abs对于stdlib.h C版本应该表现不同,如果你包括<cmath>

以下是此页面的摘录(::abs不处理std::abs):

double abs (double x); 
float abs (float x); 
long double abs (long double x);
Compute absolute value
/*
Returns the absolute value of x: |x|.
These convenience abs overloads are exclusive of C++. In C, abs is only declared
in  <cstdlib> (and operates on int values). 
The additional overloads are provided in this header (<cmath>) for the integral types: 
These overloads effectively …
Run Code Online (Sandbox Code Playgroud)

c++ cmath

24
推荐指数
1
解决办法
7277
查看次数

标签 统计

c++ ×2

cmath ×1

visual-studio-2005 ×1