我有来自 VS2003 托管 C++ 的代码片段,我想以 2010 C++/CLI 方式重写它,但较新的编译器不接受“feature_all”枚举。有人能告诉我如何正确转换它吗?
这是 VS 2003 中的代码片段:
[Flags]
__value enum Features: unsigned int
{
feature_1 = 1,
feature_2 = 2,
feature_3 = 4,
feature_all = feature_1 | feature_2 | feature_3 // accepted by compiler
};
我尝试在 VS 2010 中这样写:
[FlagsAttribute]
value class enum Features: unsigned int {
feature1 = 1,
feature2 = 2,
feature3 = 4,
feature_all = feature_1 | feature_2 | feature_3 // not accepted by compiler
};
但是第二个肯定行不通...
编译器返回 7 个错误:(C2332、C2236、3x C2065、C2056 和 C3115)