Most macro solutions are not readable nor maintainable. You should avoid macro solutions like this. The best way is to not use macros at all: typedef enum ... ... <看更多>
Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code. ... <看更多>
The enums can be converted to string, iterated, and counted, at run time or ... #include <enum.h> BETTER_ENUM(Channel, int, Red = 1, Green, Blue) Channel c ... ... <看更多>