-
Notifications
You must be signed in to change notification settings - Fork 193
Description
There are a lot of parts of our codebase, especially the CLI, that rely on strings for configuration and option handling, where using enums would be much nicer.
C++ unfortunately (and astoundingly) doesn't have builtin support for enum <--> string conversion. C++26 added reflection, which will finally allows to build such a basic utility but it'll be a few years until our codebase can make use of that.
In #3258, I made use of magic_enum for this purpose. It works very well and I think we should consider adopting this, perhaps wrapping the library in our own interface. An alternative is enchantum, which has the added benefit of lower compilation times due to template instantitations (which is something we should consider given that our compilation times are not exactly excellent).
AFAIK, both libraries are relying on compiler specific behaviour to achieve this, but all major compilers (GCC, Clang and MSVC) are supported.