C++ std::is_integral














































C++ std::is_integral



Description:
The is_integral() is used to check whether T is an integral type. If integral type
then return true else false.

Integral type include:-
   bool
   char
   char16_t
   char32_t
   wchar_t
   signed char
   short int
   int
   long int
   long long int
   unsigned char
   unsigned short int
   unsigned int
   unsigned long int
   unsigned long long int

Syntax:
template <class T> struct is_integral;

Parameter:
A type.



Code

#include <iostream> #include <type_traits> using namespace std; int main () { cout << boolalpha; cout << "char: " << is_integral < char >::value << endl; cout << "bool: " << is_integral < bool >::value << endl; cout << "int: " << is_integral < int >::value << endl; cout << "float: " << is_integral < float >::value << endl; cout << "double: " << is_integral < double >::value << endl; return 0; }

Output:
char: true
bool: true
int: true
float: false
double: false

Comments