DOMAINmath.h中的宏与枚举和可能的其他类型冲突.我不知道该怎么做.
#include <algorithm>
enum Type { DOMAIN };
int main(){
Type t = Type::DOMAIN;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
用标志-std = c ++ 11编译.这段代码的C99版本编译完全正常但:
#include <algorithm>
enum Type { DOMAIN };
int main(){
Type t = DOMAIN;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我检查了源代码,库是责备.算法包括stl_algo.h,其中有ifdef:
#if __cplusplus >= 201103L
#include <random> // for std::uniform_int_distribution
#include <functional> // for std::bind
#endif
Run Code Online (Sandbox Code Playgroud)
以下代码在c ++ 11编译器上编译良好:
#include <random>
#include <iostream>
int main(){
std::cout << DOMAIN << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
它是一个功能还是一个bug?
#ifdef DOMAIN
#undef DOMAIN
#endif
Run Code Online (Sandbox Code Playgroud)