is_class Class

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Tests if type is a class.

template <class Ty>  
struct is_class;  

Parameters

Ty
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

<type_traits>
is_compound Class
is_union Class

Show: