Share via


is_object-Klasse

Prüft, ob der Typ ein Objekttyp ist.

Syntax

template <class Ty>
struct is_object;

Parameter

Ty
Der abzufragende Typ.

Hinweise

Eine Instanz des Typprädikats enthält "false", wenn der Typ "Ty" ein Bezugstyp, ein Funktionstyp oder "void" oder eine cv-qualified Form davon ist, andernfalls "true".

Beispiel

// std__type_traits__is_object.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>

struct trivial
    {
    int val;
    };

struct functional
    {
    int f();
    };

int main()
    {
    std::cout << "is_object<trivial> == " << std::boolalpha
        << std::is_object<trivial>::value << std::endl;
    std::cout << "is_object<functional> == " << std::boolalpha
        << std::is_object<functional>::value << std::endl;
    std::cout << "is_object<trivial&> == " << std::boolalpha
        << std::is_object<trivial&>::value << std::endl;
    std::cout << "is_object<float()> == " << std::boolalpha
        << std::is_object<float()>::value << std::endl;
    std::cout << "is_object<void> == " << std::boolalpha
        << std::is_object<void>::value << std::endl;

    return (0);
    }
is_object<trivial> == true
is_object<functional> == true
is_object<trivial&> == false
is_object<float()> == false
is_object<void> == false

Anforderungen

Header:<type_traits>

Namespace: std

Siehe auch

<type_traits>
is_function-Klasse