c++ mark enum value as deprecated?

后端 未结 8 1866
再見小時候
再見小時候 2020-12-30 23:41

Is it possible to mark an enum value as deprecated?

e.g.

enum MyEnum {
    firstvalue = 0
    secondvalue,
    thirdvalue, // deprecated
    fourthva         


        
8条回答
  •  时光取名叫无心
    2020-12-31 00:18

    Beginning with GCC 6 you can simply deprecate enums:

    enum {
      newval,
      oldval __attribute__ ((deprecated ("too old")))
    };
    

    Source: https://gcc.gnu.org/gcc-6/changes.html

提交回复
热议问题