Defined in header <functional> | ||
---|---|---|
class bad_function_call; | (since C++11) |
std::bad_function_call
is the type of the exception thrown by std::function::operator()
if the function wrapper has no target.
Inheritance diagram.
(constructor) | bad_function_call() (public member function) |
bad_function_call(); |
Constructs a new instance of std::bad_function_call
.
(none).
noexcept
specification: noexcept
[virtual] | destructs the exception object (virtual public member function of std::exception ) |
[virtual] | returns an explanatory string (virtual public member function of std::exception ) |
#include <iostream> #include <functional> int main() { std::function<int()> f = nullptr; try { f(); } catch(const std::bad_function_call& e) { std::cout << e.what() << '\n'; } }
Possible output:
bad function call
(C++11) | wraps callable object of any type with specified function call signature (class template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/utility/functional/bad_function_call