std::domain_error
Defined in header <stdexcept> | | |
|---|---|---|
class domain_error; | | |
定义要作为异常抛出的对象类型。它可以被实现用来报告域错误,即输入在定义操作的域之外的情况。
标准库组件不会引发此异常%28数学函数报告域错误,如math_errhandling29%。然而,第三方库使用这个。例如,助教数学抛出std::domain_error如果boost::math::policies::throw_on_error启用%28默认设置%29。
二次
二次
继承图
成员函数
(constructor) | constructs the exception object (public member function) |
|---|
STD:领域[医]错误::域[医]误差
explicit domain_error( const std::string& what_arg ); | (1) | |
|---|---|---|
explicit domain_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

