The std::underlying_type template of C++ STL is present in the <type_traits> header file. The std::underlying_type template of C++ STL is used to get the underlying type of enum type T.
template <class T> struct underlying_type;
Parameter: The template std::underlying_type accepts a single parameter T(Trait class).
Return Value: The template std::underlying_type return the underlying type of enum type T.
Below is the program to demonstrate std::underlying_type in C++:
underlying type for 'GFG' is unsigned underlying type for 'gfg' is int
Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.