std::runtime_error
| Defined in header <stdexcept> |  |  | 
|---|---|---|
| class runtime_error; |  |  | 
定义要作为异常抛出的对象类型。它报告了由于程序范围以外的事件而导致的错误,这些错误是无法轻易预测的。
类型例外std::runtime_error由下列标准库组件引发:std::locale::locale和std::locale::combine...
此外,标准异常类型std::range_error,,,std::overflow_error,,,std::underflow_error,,,std::regex_error,和std::system_error派生自std::runtime_error...
二次
二次
继承图
成员函数
| (constructor) | constructs the exception object (public member function) | 
|---|
STD::运行时[医]错误::运行时[医]误差
| explicit runtime_error( const std::string& what_arg ); | (1) |  | 
|---|---|---|
| explicit runtime_error( const char* what_arg ); | (2) | (since C++11) | 
构造异常对象what_arg作为解释性字符串,可以通过what()...
因为复制std::exception不允许抛出异常,此消息通常作为单独分配的引用计数字符串存储在内部。这也是为什么没有构造函数std::string&&::无论如何,它必须复制内容。
参数
| what_arg | - | explanatory string | 
|---|
例外
可抛std::bad_alloc...
继承自STD:例外
成员函数
| (destructor) virtual | destructs the exception object (virtual public member function of std::exception) | 
|---|---|
| what virtual | returns an explanatory string (virtual public member function of std::exception) | 
 © cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

