The C++ Standard Library implements the two-category error model described in Section 18.1 with a set of classes. These classes, which are defined in the stdexcept header file, can be used to catch exceptions thrown by the library and to throw exceptions from your own code.
The exception handling classes are related through inheritance. The inheritance hierarchy looks like this:
exception
logic_error
domain_error
invalid_argument
length_error
out_of_range
runtime_error
range_error
overflow_error
underflow_error
Classes logic_error and runtime_error inherit from class exception. All other exception handling classes inherit from either logic_error or runtime_error.