Share via


is_compound-Klasse

Testet, ob der angegebene Typ nicht grundlegend ist.

Syntax

template <class Ty>
struct is_compound;

Parameter

Ty
Der abzufragende Typ.

Hinweise

Eine Instanz des Typprädikats enthält false , wenn der Typ von Ty ein grundlegender Typ ist (d. h. wenn is_fundamental<Ty> haltet true); andernfalls enthält truees . Daher enthält true das Prädikat, wenn Ty ein Arraytyp, ein Funktionstyp, ein Zeiger oder void ein Objekt oder eine Funktion, einen Verweis, eine Klasse, eine Vereinigung, eine Aufzählung oder einen Zeiger auf nicht statische Klassenmemmemm oder eine cv-qualifizierte Form eines davon ist.

Beispiel

// 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

Anforderungen

Header:<type_traits>

Namespace: std

Siehe auch

<type_traits>
is_class-Klasse