public member function
<functional>
std::function::operator bool
explicit operator bool() const noexcept;
Check if callable
A function object is callable if it is not an empty function (i.e., if it has a callable object as target).
Parameters
noneReturn value
true if the object is callable.false otherwise (the object is an empty function).Example
|
|
Output:
foo is not callable. bar is callable.
Data races
The object is accessed.Exception safety
No-throw guarantee: this member function never throws exceptions.See also
- function::target
- Get pointer to target (public member function)
- function::operator()
- Call target (public member function)