This class defines the type of objects thrown as exceptions to report domain errors.
Generally, the domain of a mathematical function is the subset of values that it is defined for. For example, the square root function is only defined for non-negative numbers. Thus, a negative number for such a function would be a domain error.
This class is designed so that any program, not just the elements of the standard library, can throw it as an exception.
It is defined as:
- The constructor takes a standard string object as parameter. This value is stored in the object, and its value is used to generate the C-string returned by its inherited member what.
The class inherits the what member function from exception, along with its copy constructor and asignment operator member functions.
|exception||Standard exception class (class)|
|logic_error||Logic error exception (class)|
|runtime_error||Runtime error exception (class)|
|invalid_argument||Invalid argument exception (class)|
|length_error||Length error exception (class)|
|out_of_range||Out-of-range exception (class)|