Freigeben über


is_function-Klasse

Testet, ob Typ ein Funktionstyp ist.

template<class Ty>
    struct is_function;

Parameter

  • Ty
    Der Typ in Abfragen.

Hinweise

Eine Instanz der Typprädikatgriffe true, wenn der Ty-Typ ein Funktionstyp ist; andernfalls false hält er an.

Beispiel

 

// std_tr1__type_traits__is_function.cpp 
// compile with: /EHsc 
#include <type_traits> 
#include <iostream> 
 
struct trivial 
    { 
    int val; 
    }; 
 
struct functional 
    { 
    int f(); 
    }; 
 
int main() 
    { 
    std::cout << "is_function<trivial> == " << std::boolalpha 
        << std::is_function<trivial>::value << std::endl; 
    std::cout << "is_function<functional> == " << std::boolalpha 
        << std::is_function<functional>::value << std::endl; 
    std::cout << "is_function<float()> == " << std::boolalpha 
        << std::is_function<float()>::value << std::endl; 
 
    return (0); 
    } 
 
  

Anforderungen

Header: <type_traits>

Namespace: std

Siehe auch

Referenz

<type_traits>

is_object-Klasse

Weitere Ressourcen

<type_traits> Member