std::underlying_type (3) - Linux Man Pages
Defined in header <type_traits>
template< class T > (since C++11)
If T is a complete enumeration type, provides a member typedef type that names the underlying type of T.
Otherwise, the behavior is undefined. (until C++20)
Otherwise, if T is not an enumeration type, there is no member type. Otherwise (T is an incomplete enumeration type), the program is ill-formed. (since C++20)
type the underlying type of T
template< class T > (since C++14)
using underlying_type_t = typename underlying_type<T>::type;
Each enumeration_type has an underlying type, which can be
1. Specified explicitly (both scoped and unscoped enumerations)
2. Omitted, in which case it is int for scoped enumerations or an implementation-defined integral type capable of representing all values of the enum (for unscoped enumerations)
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior
LWG_2396 C++11 incomplete enumeration types were allowed complete enumeration type required
// Run this code