TheNitesWhoSay / RareCpp

Creating a simpler, more intuitive means of C++ reflection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does this library support reflecting Enum class member to string?

eesaber opened this issue · comments

Does this library support reflecting Enum class member to string?

For example, I have a enum class Foo

enum class Foo {
  kBar,
  kBaz,
};

And I want to convert to string

"kBar", "kBaz"

No, enum to string is not supported by RareCpp, at least in the short term I've decided I can't do this better than existing libraries (full-support for typical enum reflection activities is a very non-trivial problem) depending on your needs I recommend one of:

I am currently working on a side project in ORM (Object-Relational Mapping). One of my requirements is to be able to map database enum types to C++ enum types, and vice versa.

Thanks a lot for the suggestion of using the magic_enum library. I will take a look at it and see if it fits my needs.