# <stdexcept>
<stdexcept>
# ``
* * *
Include the standard header **``**
to define several classes used for reporting exceptions.
The classes form a derivation hierarchy, as indicated by the indenting
above, all derived from class
`exception`.
namespace std {
class logic_error;
class domain_error;
class invalid_argument;
class length_error;
class out_of_range;
class runtime_error;
class range_error;
class overflow_error;
class underflow_error;
} // namespace stdCopy to clipboard
## `domain_error`
class domain_error : public logic_error {
public:
domain_error(const string& message);
};Copy to clipboard
The class serves as the base class for all exceptions thrown
to report a
[domain error](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_math.html#domain%20error). The value returned by
`what()` is a copy of
`message.data()`.
## `invalid_argument`
class invalid_argument : public logic_error {
public:
invalid_argument(const string& message);
};Copy to clipboard
The class serves as the base class for all exceptions thrown
to report an invalid argument. The value returned by
`what()` is a copy of
`message.data()`.
## `length_error`
class length_error : public logic_error {
public:
length_error(const string& message);
};Copy to clipboard
The class serves as the base class for all exceptions thrown
to report an attempt to generate an object too long to be specified.
The value returned by
`what()` is a copy of
`message.data()`.
## `logic_error`
class logic_error : public exception {
public:
logic_error(const string& message);
};Copy to clipboard
The class serves as the base class for all exceptions thrown
to report errors presumably detectable before the program executes,
such as violations of logical preconditions. The value returned by
`what()` is a copy of
`message.data()`.
## `out_of_range`
class out_of_range : public logic_error {
public:
out_of_range(const string& message);
};Copy to clipboard
The class serves as the base class for all exceptions thrown
to report an argument that is out of its valid range. The value returned by
`what()` is a copy of
`message.data()`.
## `overflow_error`
class overflow_error : public runtime_error {
public:
overflow_error(const string& message);
};Copy to clipboard
The class serves as the base class for all exceptions thrown
to report an arithmetic overflow. The value returned by
`what()` is a copy of
`message.data()`.
## `range_error`
class range_error : public runtime_error {
public:
range_error(const string& message);
};Copy to clipboard
The class serves as the base class for all exceptions thrown
to report a
[range error](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_math.html#range%20error). The value returned by
`what()` is a copy of
`message.data()`.
## `runtime_error`
class runtime_error : public exception {
public:
runtime_error(const string& message);
};Copy to clipboard
The class serves as the base class for all exceptions thrown
to report errors presumably detectable only when the program executes.
The value returned by
`what()` is a copy of
`message.data()`.
## `underflow_error`
class underflow_error : public runtime_error {
public:
underflow_error(const string& message);
};Copy to clipboard
The class serves as the base class for all exceptions thrown
to report an arithmetic underflow. The value returned by
`what()` is a copy of
`message.data()`.
* * *
See also the
**[Table of Contents](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_index.html#Table%20of%20Contents)** and the
**[Index](https://docs.qualcomm.com/doc/80-N3040-23/topic/_cpp_index.html)**.
*[Copyright](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_crit_pjp.html) © 1992-2006by P.J. Plauger. All rights reserved.*
Last Published: Oct 06, 2026
Previous Topic
Next Topic