description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | |||
---|---|---|---|---|---|---|---|---|
Learn more about: is_class Class |
is_class Class |
11/04/2016 |
|
|
96fc34a3-a81b-4ec6-b7fb-baafde1a0f4e |
Tests if type is a class.
template <class Ty>
struct is_class;
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__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