Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Tests if type is not scalar.
template<class Ty>
struct is_compound;
Parameters
- Ty
The type to query.
Remarks
An instance of the type predicate holds false if the type Ty is a scalar type (that is, if is_scalar Class<Ty> holds true), otherwise it holdstrue. 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.
Example
// std_tr1__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::tr1::is_compound<trivial>::value << std::endl;
std::cout << "is_compound<int[]> == " << std::boolalpha
<< std::tr1::is_compound<int[]>::value << std::endl;
std::cout << "is_compound<int()> == " << std::boolalpha
<< std::tr1::is_compound<int()>::value << std::endl;
std::cout << "is_compound<int&> == " << std::boolalpha
<< std::tr1::is_compound<int&>::value << std::endl;
std::cout << "is_compound<void *> == " << std::boolalpha
<< std::tr1::is_compound<void *>::value << std::endl;
std::cout << "is_compound<int> == " << std::boolalpha
<< std::tr1::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
Requirements
Header: <type_traits>
Namespace: std::tr1