The
std::is_enum template of C++ STL is used to check whether the given type is enum or not. It returns a boolean value showing the same.
Syntax:
template <class T> struct is_enum;
Parameter: This template accepts single parameter
T (Trait class) to check whether T is a enumeration type or not.
Return Value: This template returns a boolean value as shown below:
- True: if the type is a enumeration.
- False: if the type is a non-enumeration.
Below programs illustrate the std::is_enum template in C++:
Program 1::
Output:
is_enum:
GFG1: false
GFG2: true
Program 2::