description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | |||
---|---|---|---|---|---|---|---|---|
Learn more about: is_union Class |
is_union Class |
11/04/2016 |
|
|
80eda256-40b8-4db5-9ac1-d58bb8032a3e |
Tests if type is a union.
template <class Ty>
struct is_union;
Ty
The type to query.
An instance of the type predicate holds true if the type Ty is a union type or a cv-qualified
form of a union type, otherwise it holds false.
// std__type_traits__is_union.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
struct trivial
{
int val;
};
union ints
{
int in;
long lo;
};
int main()
{
std::cout << "is_union<trivial> == " << std::boolalpha
<< std::is_union<trivial>::value << std::endl;
std::cout << "is_union<int> == " << std::boolalpha
<< std::is_union<int>::value << std::endl;
std::cout << "is_union<ints> == " << std::boolalpha
<< std::is_union<ints>::value << std::endl;
return (0);
}
is_union<trivial> == false
is_union<int> == false
is_union<ints> == true
Header: <type_traits>
Namespace: std