How do I get the fundamental type of an enum?

后端 未结 2 2004
花落未央
花落未央 2021-01-04 10:39

With a declaration such as:

enum DrawBoldMode : unsigned
{
    DBM_NONE =              0,
    DBM_ITEM =              1<<0,   // bold just the nearest          


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-04 11:08

    It should be available as std::underlying_type::type. However, my compiler (GCC 4.6.1) doesn't seem to implement that.

    I think it's impossible to implement it with templates, but I could be wrong about that.

提交回复
热议问题