Last active
July 1, 2018 08:26
-
-
Save TheEyesightDim/6b50a5000c758bca0c36142350b4eb1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this function converts any member of enum of any underlying type to that type. | |
//Effective Modern C++ by Scott Meyers. See item 10 | |
template <typename E> | |
constexpr auto to_underlying(E e) noexcept | |
{ | |
return static_cast<std::underlying_type_t<E>>(e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment