C++ Exception 库 - bad_function_call
描述
这是错误调用引发的异常。
声明
以下是 std::bad_function_call 的声明。
class bad_function_call;
C++11
class bad_function_call;
参数
none
返回值
none
异常
No-throw guarantee − 没有成员抛出异常。
示例
在下面的 std::bad_function_call 示例中。
#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';
}
}
示例输出应该是这样的 −
bad_function_call

