is_class

| Home | Libraries | People | FAQ | More

### is_class

    template <class T>
    struct is_class : public true_type-or-false_type {};

Inherits: If T is a (possibly cv-qualified) class type then inherits from true_type, otherwise inherits from false_type.

C++ Standard Reference: 3.9.2 and 9.2.

Header: `#include <boost/type_traits/is_class.hpp>` or `#include <boost/type_traits.hpp>`

Compiler Compatibility: Without (some as yet unspecified) help from the compiler, we cannot distinguish between union and class types, as a result this type will erroneously inherit from true_type for union types. See also is_union. Currently (May 2005) only Visual C++ 8 has the necessary compiler intrinsics to correctly identify union types, and therefore make is_class function correctly.

Examples:

> Given: `class MyClass;` then:

> `is_class<MyClass>` inherits from `true_type`.

> `is_class<MyClass const>::type` is the type `true_type`.

> `is_class<MyClass>::value` is an integral constant expression that evaluates to true.

> `is_class<MyClass&>::value` is an integral constant expression that evaluates to false.

> `is_class<MyClass*>::value` is an integral constant expression that evaluates to false.

> `is_class<T>::value_type` is the type `bool`.