is_function Class

如果型別是函式型別,測試。

template<class Ty>
    struct is_function;

參數

  • Ty
    要查詢的類型。

備註

如果為 true,則保留型別述詞的執行個體的型別Ty是函式型別,否則它會保留,則為 false。

範例

 

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

需求

標頭: <type_traits>

Namespace: 標準

請參閱

參考

<type_traits>

is_object Class

其他資源

<type_traits> 成員