std::numeric_limits::max() std::numeric_limits::min()編譯錯誤
【原文:http://blog.csdn.net/manyikaimen/article/details/51565321】
今天使用了一下STL中的z數值極限竟然編譯不過,
std::numeric_limits::max()
出現如下錯誤:
warning C4003: “max”巨集的實參不足
error C2589: “(” : “::”右邊的非法標記
error C2589: “(” : “::”右邊的非法標記
google了一下,原來是需要把max用括號括起來避免和windows定義的巨集混淆
(std::numeric_limits::max)()
因為Windef.h中定義了
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
所以會產生編譯錯誤
相關文章
- 詭異!std::bind in std::bind 編譯失敗編譯
- std::sort 錯誤"Expression : invalid operator <"Express
- c++11:std::boolalpha、std::noboolalphaC++
- std::vector 和 std::list 區別
- std::reserve和std::resize的區別
- C++11 std::bind std::function 高階用法C++Function
- 【C++併發實戰】(三) std::future和std::promiseC++Promise
- C++ 標準庫 std::set std::multiset swap()的使用C++
- ODRDMS_GOV_STDGo
- std::count 函式函式
- (C++11/14/17學習筆記):std::atomic續、std::async與std::thread對比C++筆記thread
- 【譯】對Rust中的std::io::Error的研究RustError
- c++11:std::bindC++
- std::map initializer list syntax ?
- std::remove_if 介紹REM
- std::tr1::functionFunction
- (不要)使用std::threadthread
- 透徹理解C++11新特性:右值引用、std::move、std::forwardC++Forward
- 智慧指標思想實踐(std::unique_ptr, std::shared_ptr)指標
- error C4996: 'std::_Uninitialized_copy0':與錯誤 LNK2001 無法解析的外部符號 "private: static class std::allocatorError996Zed符號
- VS 編譯錯誤編譯
- c++ std::vector 切記C++
- c++11:std::is_sameC++
- 理解 std::declval 和 decltype
- std::async的使用總結
- MAX or MIN of Indexed ColumnIndex
- min(), max()和indexIndex
- ipvs編譯錯誤編譯
- php編譯小錯誤PHP編譯
- 編譯PHP的錯誤編譯PHP
- std::string的工具函式函式
- C++中std::allocator的使用C++
- FBI? MAX? INDEX FULL SCAN (MIN/MAX)?Index
- C++11中std::move、std::forward、左右值引用、移動建構函式的測試C++Forward函式
- Min-Max 容斥
- std::unique_ptr使用incomplete type的報錯分析和解決
- std::ostringstream::str()返回臨時物件物件
- 最近編譯tolua_runtime安卓編譯錯誤編譯安卓