Which C++ type trait is used to check whether a type is an integral type?
Options
- A. std::is_integral
- B. std::is_pointer
- C. std::is_class
- D. More than one of the above
- E. None of the above
Quiz Practice:
A. std::is_integral
Answer: (A) std::is_integral
std::is_integral is a C++ type trait used to determine whether a type is an integral type.
Examples of integral types include int, short, long, char, bool and their signed or unsigned versions.
For example, std::is_integral<int>::value gives true, while a floating-point type such as double gives false.