mar*_*hon 1 c++ namespaces compiler-errors visual-studio-2010 c++11
这适用于xcode,但不适用于visual studio.错误是
错误C2236:意外的'enum''abc :: def ::`anonymous-namespace'::'.你忘记了';'吗?
我无法弄清楚出了什么问题.
namespace abc {
namespace def {
namespace {
long long enum {
aaa = 1L,
bbb = 2L,
};
}
}
}
Run Code Online (Sandbox Code Playgroud)
这种语法很奇怪,我看不出它在任何地方都能起作用(编辑:显然它是GCC扩展 - 感谢@PlasmaHH).这是您想要的可移植C++ 11语法:
enum : long long {
aaa = 1LL,
bbb = 2LL
};
Run Code Online (Sandbox Code Playgroud)