Skip to content

Conversation

@sdebionne
Copy link

An example that shows how to support enums as options with Boost.ProgamOptions.

@pdimov
Copy link
Member

pdimov commented Feb 19, 2022

Maybe update this to use enum_from_string and enum_to_string?

@pdimov
Copy link
Member

pdimov commented Feb 19, 2022

Also, the op<< overload for described enums probably belongs to operators.hpp?

@sdebionne
Copy link
Author

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?

@pdimov
Copy link
Member

pdimov commented Mar 1, 2022

I already added fmtlib examples.

@sdebionne
Copy link
Author

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?

@pdimov
Copy link
Member

pdimov commented Mar 7, 2022

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.

@sdebionne sdebionne force-pushed the feature/add-program-options-example branch from 66a650a to 65da24f Compare March 7, 2022 15:36
@sdebionne
Copy link
Author

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<<; ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants