operator!= <function>

更新 : 2007 年 11 月

呼び出し可能オブジェクトが空でないかどうかをテストします。

template<class Fty>
    bool operator!=(const function<Fty>& f, null_ptr_type npc);
template<class Fty>
    bool operator!=(null_ptr_type npc, const function<Fty>& f);

パラメータ

  • Fty
    ラップする関数の型。

  • f
    function オブジェクト。

  • npc
    null ポインタ。

解説

これらの演算子では、引数として、function オブジェクトへの参照と null ポインタ定数が使用されます。どちらも、function オブジェクトが空以外の場合にのみ、true を返します。

使用例

 

// std_tr1__functional__operator_ne.cpp 
// compile with: /EHsc 
#include <functional> 
#include <iostream> 
 
int neg(int val) 
    { 
    return (-val); 
    } 
 
int main() 
    { 
    std::tr1::function<int (int)> fn0; 
    std::cout << std::boolalpha << "not empty == " 
        << (fn0 != 0) << std::endl; 
 
    std::tr1::function<int (int)> fn1(neg); 
    std::cout << std::boolalpha << "not empty == " 
        << (fn1 != 0) << std::endl; 
 
    return (0); 
    } 
 
not empty == false
not empty == true

必要条件

ヘッダー : <functional>

名前空間 : std::tr1

参照

参照

<functional> (TR1)

operator== <function>