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

std::out_of_range

Defined in header <stdexcept>

class out_of_range;

定义要作为异常抛出的对象类型。它报告试图访问超出定义范围的元素所导致的错误。

的成员函数可以抛出std::bitsetstd::basic_string,通过std::stoistd::stod函数族,并按边界检查成员访问函数%28等。std::vector::atstd::map::at29%。

二次

二次

继承图

成员函数

(constructor)

constructs the exception object (public member function)

STD:出局[医]成[医]范围:Out[医]成[医]范围

explicit out_of_range( const std::string& what_arg );

(1)

explicit out_of_range( 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)

注记

标准误差条件std::errc::result_out_of_range通常表示结果(而不是输入)超出范围,并且与std::range_errorERANGE...

另见

at

access specified character with bounds checking (public member function of std::basic_string)

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

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

扫码关注腾讯云开发者

领取腾讯云代金券