c++ throw index out of range exception code example
Example: exception out of range c++
Defines a type of object to be thrown as exception.
It reports errors that are consequence of attempt to access elements out of
defined range.
It may be thrown by the member functions of std::bitset and std::basic_string,
by std::stoi and std::stod families of functions,
and by the bounds-checked member access functions
(e.g. std::vector::at and std::map::at).