3 ms·
I suggested an underlying_cast function that converts a typed-enum to its underlying type. It's quite useful for things like sending typed enums to streams.
by dirtydroog 6y ago
I suggested an underlying_cast function that converts a typed-enum to its underlying type. It's quite useful for things like sending typed enums to streams.
- saagarjha 6y agoThat's just static_cast<std::underlying_type_t<EnumType>>(value), right?
- dirtydroog 6y agoYes, pretty much. But everyone will probably end up writing this at some point. It may as well be in the standard library.