Difference between revisions of "cpp/utility/functional/bad function call"
From cppreference.com
< cpp | utility | functional
(Undo revision 88912 by me (talk)) |
(possible output) |
||
Line 49: | Line 49: | ||
} | } | ||
} | } | ||
+ | |p=true | ||
| output= | | output= | ||
bad function call | bad function call |
Revision as of 08:13, 19 December 2016
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
Contents |
Member functions
(constructor) |
bad_function_call() (public member function) |
std::bad_function_call::bad_function_call()
bad_function_call(); |
||
Constructs a new instance of std::bad_function_call
.
Parameters
(none)
Exceptions
noexcept specification:
noexcept
Inherited from std::exception
Member functions
[virtual] |
destroys the exception object (virtual public member function of std::exception )
|
[virtual] |
returns an explanatory string (virtual public member function of std::exception )
|
Example
Run this code
#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
See also
(C++11) |
copyable wrapper of any copy constructible callable object (class template) |