首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::unexpected

Defined in header <exception>

void unexpected();

(until C++11)

[noreturn] void unexpected();

(until C++17) (since c++11, deprecated in C++11)

std::unexpected()时C++运行时调用动态异常规范被违反:从其异常规范禁止此类异常的函数引发异常。

std::unexpected()也可以直接从程序调用。

不管是哪种情况,std::unexpected调用当前安装的std::unexpected_handler.默认std::unexpected_handler打电话std::terminate...

If a destructor reset the unexpected handler during stack unwinding and the unwinding later led to unexpected being called, the handler that was installed at the end of the throw expression is the one that will be called. (note: it was ambiguous whether re-throwing applied the new handlers).

(until C++11)

If a destructor reset the unexpected handler during stack unwinding, it is unspecified which handler is called if the unwinding later led to unexpected being called.

(since C++17)

参数

%280%29

返回值

%280%29

例外

引发当前安装的任何异常。std::unexpected_handler...

另见

unexpected_handler (until C++17)

the type of the function called by std::unexpected (typedef)

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券