【发布时间】:2015-10-04 14:33:03
【问题描述】:
我使用了一个 C++11 库,它的头文件带有一个嵌套在类中的枚举类:
class ClassWithARatherLongName
{
public:
enum class EnumWithARatherLongName
{
VALUE1,
VALUE2,
VALUE3
};
(other code)
};
然后我在我的代码中使用枚举器:
void foo()
{
... ClassWithARatherLongName::EnumWithARatherLongName::VALUE1 ...
}
这可行,但很乏味。没有办法缩写语法吗?
理想情况下,我希望能够编写如下内容:
void foo()
{
(some directive that allows to use an abbreviated syntax)
... VALUE1 ...
}
【问题讨论】: