I have a variable declared as:
enum class FooEnum: uint64_t {}
and I would like to cast to its base-type, but I don\'t want to hardcode the
Your guessed syntax is amazingly close. You're looking for std::underlying_type in :
std::underlying_type
#include #include enum class FooEnum: std::uint64_t {}; int main() { FooEnum myEnum; uint64_t* intPointer = (std::underlying_type::type*)&myEnum; }