Skip to content
/ DefEnum Public

Use a macro to define both enum class and string conversion functions

License

Notifications You must be signed in to change notification settings

xshenf/DefEnum

Repository files navigation

DefEnum

使用宏定义,生成enum与string相互转换函数StringOf(Enum),TypeOfEnum(string)

usage

#define EM_ARGS1(x) x(a) x(b1) x(b2)
ENUM_CLASS(EMType21, EM_ARGS1)

#define EM_ARGS2(x) x(1, a) x(3, b1) x(5, b2)
ENUM_CLASS(EMType2, char, EM_ARGS2)

#define EM_ARGS3(x) x(2, a, "A") x(4, b1, "B1") x(6, b2, "B2")
ENUM_CLASS(EMType41, int, EM_ARGS1, COUNT)

About

Use a macro to define both enum class and string conversion functions

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published