Scope resolution operator on enums a compiler-specific extension?

前端 未结 5 1698
你的背包
你的背包 2020-12-19 05:33

On this question, there\'s an answer that states:

You can use typedef to make Colour enumeration type accessible without specifying it\'s \"full name\

5条回答
  •  半阙折子戏
    2020-12-19 05:46

    That is not standard.

    In C++11, you will be able to make scoped enums with an enum class declaration.

    With pre-C++11 compilers, to scope an enum, you will need to define the enum inside a struct or namespace.

提交回复
热议问题