Here:
http://en.cppreference.com/w/cpp/utility/functional/function
operator bool is described: “Checks whether the stored callable object is valid”.
Presumably a default constructed std::function is not valid but is this the only case?
Also, how does it check whether it is valid?
Is the case where operator() raises std::bad_function_call exactly the case where the object is not valid?
It’s poorly written as is, your confusion is justified. By “valid” they mean “has a target”.
A
std::function“has a target” when it’s been assigned a function:They should have either defined “valid” before they used it, or simply stuck with the official wording.