operator!= <functional>

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

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::function<int (int)> fn0; 
    std::cout << std::boolalpha << "not empty == " 
        << (fn0 != 0) << std::endl; 
 
    std::function<int (int)> fn1(neg); 
    std::cout << std::boolalpha << "not empty == " 
        << (fn1 != 0) << std::endl; 
 
    return (0); 
    } 
 
  

必要条件

ヘッダー : <functional>

名前空間: std

参照

関連項目

operator== <functional>