次の方法で共有


is_function クラス

型が関数型であるかどうかをテストします。

template<class Ty>
    struct is_function;

パラメーター

  • Ty
    問い合わせる型。

解説

型 Ty が関数型である場合、型述語のインスタンスは true を保持します。それ以外の場合は、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>

名前空間: std

参照

関連項目

<type_traits>

is_object クラス

その他の技術情報

<type_traits> メンバー