Skip to content

Instantly share code, notes, and snippets.

@gomons
Last active June 15, 2016 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gomons/f7c9eecbb26b48374166a3b5858e2d72 to your computer and use it in GitHub Desktop.
Save gomons/f7c9eecbb26b48374166a3b5858e2d72 to your computer and use it in GitHub Desktop.
Convert enum class value to undrlying type
template <typename E> constexpr typename std::underlying_type<E>::type to_underlying(E e) {
return static_cast<typename std::underlying_type<E>::type>(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment