morganstanley/binlog

Automated enum adapation

Opened this issue · 1 comments

Using something like https://github.com/Neargye/magic_enum it would be possible to auto adapt enums for the user without them having to manually list all the various enum values. Completely understandable if you don't want to take a dependency like this - but just a thought.

This looks promising indeed. (I wonder how fast it can be compiled) Binlog is desinged in a way that adaptions can be added without forcing a dependency on everyone, e.g: there's adapt_stdvariant.hpp, that can be included, if the user wants it. In a similar manner, we could have:

#include <binlog/adapt_magic_enum.hpp> // requires user installing magic_enum

enum Foo { a, b, c};
BINLOG_ADAPT_MAGIC_ENUM(Foo)

Alternatively, we could also have:

#include <binlog/auto_adapt_magic_enum_compatible_enums.hpp>

that adds a specialization for every enum type, that magic enum supports. I don't know yet if it is feasible.
(I have little time to clear the backlog, so it will take a long time probably)