Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Tests if callable object is 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);
Parameters
Fty
The function type to wrap.f
The function objectnpc
A null pointer.
Remarks
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 empty.
Example
// std_tr1__functional__operator_eq.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 << "empty == "
<< (fn0 == 0) << std::endl;
std::function<int (int)> fn1(neg);
std::cout << std::boolalpha << "empty == "
<< (fn1 == 0) << std::endl;
return (0);
}
empty == true empty == false
Requirements
Header: <functional>
Namespace: std