定义要作为异常引发的对象类型。它报告试图访问定义范围之外的元素所导致的错误。它可以由std::bitset和std::basic_string的成员函数、std::stoi和std::stod函数族以及边界检查的成员访问函数(例如std::vector::at和std::map::at)抛出。
继承关系如下:

Member functions

1-2) Constructs the exception object with what_arg as explanatory string that can be accessed through what() .
3) Copy constructor. If *this and other both have dynamic type std::out_of_range then std:: strcmp (what ( ), other. what ( ) ) == 0. (since C++11)

Parameters

what_arg explanatory string

Notes

Because copying std::out_of_range is not permitted to throw exceptions, this message is typically stored internally as a separately-allocated reference-counted string. This is also why there is no constructor taking std::string&& : it would have to copy the content anyway.

Assigns the contents of other . If *this and other both have dynamic type std::out_of_range then std:: strcmp (what ( ), other. what ( ) ) == 0 after assignment. (since C++11)

Parameters

other another exception object to assign