We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

is_class Class

Tests if type is a class.

template<class Ty>
    struct is_class;


The type to query.

An instance of the type predicate holds true if the type Ty is a type defined as a class or a struct, or a cv-qualified form of one of them, otherwise it holds false.


// std_tr1__type_traits__is_class.cpp 
// compile with: /EHsc 
#include <type_traits> 
#include <iostream> 
struct trivial 
    int val; 
int main() 
    std::cout << "is_class<trivial> == " << std::boolalpha 
        << std::is_class<trivial>::value << std::endl; 
    std::cout << "is_class<int> == " << std::boolalpha 
        << std::is_class<int>::value << std::endl; 
    return (0); 
is_class<trivial> == true
is_class<int> == false

Header: <type_traits>

Namespace: std