We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In my embedded project, I utilize std::optional heavily. Unfortunately, better_enum::optional doesn't have a built in conversion.
std::optional
better_enum::optional
I can see two options:
Here's a member conversion function I threw together quickly:
#if defined(__cpp_lib_optional) && (__cpp_lib_optional >= 201606L) BETTER_ENUMS_CONSTEXPR_ operator std::optional<T>() const { if(*this) {return {_value};} else {return std::nullopt;} } #endif
The text was updated successfully, but these errors were encountered:
Thank you! Would you be willing to propose this as a PR?
Sorry, something went wrong.
Sure thing. I wasn't sure if that quickly put together operator was good enough, but if it is, I'll go ahead and submit a PR.
No branches or pull requests
In my embedded project, I utilize
std::optional
heavily. Unfortunately,better_enum::optional
doesn't have a built in conversion.I can see two options:
better_enum::optional
withstd::optional
std::optional
Here's a member conversion function I threw together quickly:
The text was updated successfully, but these errors were encountered: