Open sdebionne opened 3 years ago
Maybe update this to use enum_from_string and enum_to_string?
Also, the op<< overload for described enums probably belongs to operators.hpp?
Indeed, this PR needs an update... I have more of these kind of examples (e.g. integration with fmt::format, pybind11...), do you think it's worth merging them to your repos?
I already added fmtlib examples.
Also, the op<< overload for described enums probably belongs to operators.hpp?
AFAIU, using boost::describe::operators::operator<<;
only works with described structs/classes not enum, no?
Yes, but we can add an operator<<
for enums there as well. Although that would make it impossible to use just one of the two as they are both called boost::describe::operators::operator<<
so using
will expose both.
I think an overload of operator<<
for enums would be welcome (just added in the fixup). What if we put them in different namespaces aka using boost::describe::enum_operators::operator<<;
?
An example that shows how to support
enum
s as options with Boost.ProgamOptions.