Which type trait checks whether a given type is a class type in C++?
Options
- A. std::is_class
- B. std::is_integral
- C. std::is_array
- D. More than one of the above
- E. None of the above
Quiz Practice:
A. std::is_class
Answer: (A) std::is_class
std::is_class is a type trait used to determine whether a specified type is a class type.
For example, if Student is a class, then std::is_class<Student>::value evaluates to true.
For a fundamental type such as int, the result is false.
It is useful when writing templates that need to distinguish class types from other types.