std::unexpected
STD::出乎意料
Defined in header | | |
---|---|---|
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) |
---|
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。