VOOZH about

URL: https://www.geeksforgeeks.org/cpp/stdis_enum-template-in-c/

⇱ std::is_enum Template in C++ - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

std::is_enum Template in C++

Last Updated : 19 Nov, 2018
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::
Output:
is_enum:
GFG1: false
GFG2: true
int: false
Comment
Article Tags: