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
https://stackoverflow.com/questions/8357240/how-to-automatically-convert-strongly-typed-enum-into-int/33083231#33083231 https://godbolt.org/z/nvaxW5a74
#include <type_traits> enum Color { Red, Green, Blue, }; template <typename E> constexpr auto to_underlying(E e) noexcept { return static_cast<std::underlying_type_t<E>>(e); } int main() { Color c = Green; int c_int = to_underlying(c); return c_int; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://stackoverflow.com/questions/8357240/how-to-automatically-convert-strongly-typed-enum-into-int/33083231#33083231
https://godbolt.org/z/nvaxW5a74
The text was updated successfully, but these errors were encountered: