std::overflow_error
Defined in header <stdexcept> | | |
|---|---|---|
class overflow_error; | | |
定义要作为异常抛出的对象类型。它可用于报告算术溢出错误%28,也就是说,对于目标类型%29,计算结果太大的情况。
引发此异常的唯一标准库组件是std::bitset::to_ulong和std::bitset::to_ullong...
标准库组件的数学函数不会抛出此异常%28数学函数报告溢出错误,如math_errhandling29%。然而,第三方库使用这个。例如,助教数学抛出std::overflow_error如果boost::math::policies::throw_on_error启用%28默认设置%29。
二次
二次
继承图
成员函数
(constructor) | constructs the exception object (public member function) |
|---|
性病:溢出[医]错误::溢出[医]误差
explicit overflow_error( const std::string& what_arg ); | (1) | |
|---|---|---|
explicit overflow_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

