다음을 통해 공유


operator!= <functional>

Tests if callable object is not empty.

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
    The function type to wrap.

  • f
    The function object

  • npc
    A null pointer.

설명

The operators both take an argument that is a reference to a function object and an argument that is a null pointer constant. Both return true only if the function object is not empty.

예제

 

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

요구 사항

헤더: <기능>

네임스페이스: std

참고 항목

참조

operator== <functional>