std::out_of_range characterized in header

class out_of_range;

specifies a type of thing to be thrown as exception. The reports errors that are consequence of effort to access elements the end of characterized range.

You are watching: Std::out_of_range

It may be thrown through the member attributes of std::bitset and also std::basic_string, by std::stoi and also std::stod households of functions, and by the bounds-checked member access functions (e.g. Std::vector::at and also std::map::at).



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

clear out_of_range( const char* what_arg ); (2) (since C++11)
Constructs the exemption object with what_arg together explanatory string that deserve to be accessed with what().

Because copy std::out_of_range is not permitted to litter exceptions, this post is frequently stored internally as a separately-allocated reference-counted string. This is likewise why over there is no constructor taking std::string&&: it would need to copy the content anyway.


what_arg - explanatory wire


May litter std::bad_alloc.

See more: I Like This Plan And I Excited To Be A Part Of It, I Love This Plan Excited To Be A Part Of It Gif


The conventional error problem std::errc::result_out_of_range frequently indicates the condition where the result, fairly than the input, is the end of range, and is an ext closely regarded std::range_error and ERANGE.

See also

accesses the stated character through bounds check (public member role of std::basic_string)