How to Get enum item name from its value

后端 未结 10 965
天涯浪人
天涯浪人 2020-12-08 09:56

I declared a enum type as this,

enum WeekEnum
{
Mon = 0;
Tue = 1;
Wed = 2;
Thu = 3;
Fri = 4;
Sat = 5;
Sun = 6;
};

How can I get the item na

10条回答
  •  失恋的感觉
    2020-12-08 10:13

    No, you have no way to get the "name" from the value in C++ because all the symbols are discarded during compilation.

    You may need this way X Macros

提交回复
热议问题