Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

is_compound Class

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_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::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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.