在本地C++中,我们可以在类定义中使用枚举招:枚举招用C++/CLI
namespace EFoo
{
enum { a = 10; };
}
class Foo
{
// Declare an array of 10 integers.
int m_Arr[EFoo::a];
};
然而,在C++/CLI管理枚举,
public enum class EFoo
{
a = 10,
};
EFoo ::一个couldn不会被隐式转换为int,因此枚举技巧将不被允许。
有什么解决方法吗?
谢谢。
永远不要认为编译器接受类定义中的转换。 – Wilson 2010-12-14 23:48:56
那么,你不是在投射类或类的定义。你只是施放枚举值。 – 2010-12-14 23:52:43