Freigeben über


is_object-Klasse

Testet, ob Typ ein Objekttyp ist.

template<class Ty>
    struct is_object;

Parameter

  • Ty
    Der Typ in Abfragen.

Hinweise

Eine Instanz des Typprädikats wird False, wenn der Typ Ty ein Verweistyp, ein Funktionstyp oder void ist, oder ein cv-qualified Formular von einem davon; andernfalls von Griffen true an.

Beispiel

 

// std_tr1__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); 
    } 
 
  

Anforderungen

Header: <type_traits>

Namespace: std

Siehe auch

Referenz

<type_traits>

is_function-Klasse

Weitere Ressourcen

<type_traits> Member