目录

bad_function_call

描述 (Description)

这是一个糟糕的通话抛出的异常。

声明 (Declaration)

以下是std :: bad_function_call的声明。

class bad_function_call;

C++11

class bad_function_call;

参数 (Parameters)

没有

返回值 (Return Value)

没有

异常 (Exceptions)

No-throw guarantee - 没有成员抛出异常。

例子 (Example)

在下面的示例中为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
↑回到顶部↑
WIKI教程 @2018