Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
Miscellaneous
complex
exception
functional
iterator
limits
locale
memory
new
numeric
stdexcept
typeinfo
utility
valarray
stdexcept
domain_error
invalid_argument
length_error
logic_error
out_of_range
overflow_error
range_error
runtime_error
underflow_error


runtime_error

class
<stdexcept>
class runtime_error;

Runtime error exception

runtime_error

This class defines the type of objects thrown as exceptions to report errors that can only be determined during runtime.

It is used as a base class for several runtime error exceptions, and is defined as:
1
2
3
4
class runtime_error : public exception {
public:
  explicit runtime_error (const string& what_arg);
};


Its sibling class logic_error is used as a base for exceptions reporting an error that can be prevented before runtime.

Members

constructor
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 (see exception for more info).

The class inherits the what member function from exception, along with its copy constructor and asignment operator member functions.

See also