Neargye / magic_enum

Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code
MIT License
4.64k stars 420 forks source link

Provide reflection data as compile time lists rather than array #196

Open Julien-Blanc-tgcm opened 2 years ago

Julien-Blanc-tgcm commented 2 years ago

Working with arrays in a compile time context is not the easiest thing. It is much more convenient to work with integer_list. Boost describe ( https://www.boost.org/doc/libs/1_79_0/libs/describe/doc/html/describe.html ) provides also reflection on enums, but uses a slightly different structure:

«

A descriptor list is a type of the form L<D1, D2, …​, Dn>, where L is of the form template<class…​ T> struct L {}; and Di is of the form

struct Di { static constexpr E value; static constexpr char const* name; };

»

It would be nice if we could also get this, in addition to what is currently provided, with magic_enum.

Neargye commented 2 years ago

Oh, I haven't seen this library in boost yet, I'll take a look at it.