description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | |||
---|---|---|---|---|---|---|---|---|
Learn more about: is_compound Class |
is_compound Class |
11/04/2016 |
|
|
bdad1167-cf3f-4f37-8321-62a5df159ead |
Tests if the specified type is not fundamental.
template <class Ty>
struct is_compound;
Ty
The type to query.
An instance of the type predicate holds false
if the type of Ty is a fundamental type (that is, if is_fundamental<Ty> holds true
); otherwise, it holds true
. Thus, the predicate holds true
if Ty is an array type, a function type, a pointer to void
or an object or a function, a reference, a class, a union, an enumeration, or a pointer to non-static class member, or a cv-qualified form of one of them.
// std__type_traits__is_compound.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
struct trivial
{
int val;
};
int main()
{
std::cout << "is_compound<trivial> == " << std::boolalpha
<< std::is_compound<trivial>::value << std::endl;
std::cout << "is_compound<int[]> == " << std::boolalpha
<< std::is_compound<int[]>::value << std::endl;
std::cout << "is_compound<int()> == " << std::boolalpha
<< std::is_compound<int()>::value << std::endl;
std::cout << "is_compound<int&> == " << std::boolalpha
<< std::is_compound<int&>::value << std::endl;
std::cout << "is_compound<void *> == " << std::boolalpha
<< std::is_compound<void *>::value << std::endl;
std::cout << "is_compound<int> == " << std::boolalpha
<< std::is_compound<int>::value << std::endl;
return (0);
}
is_compound<trivial> == true
is_compound<int[]> == true
is_compound<int()> == true
is_compound<int&> == true
is_compound<void *> == true
is_compound<int> == false
Header: <type_traits>
Namespace: std