The <exception> header provides functions and classes for exception control. One basic class is exception:
class exception { public: exception() throw(); exception(const exception&) throw(); exception& operator=(const exception&) throw(); virtual ~exception() throw(); virtual const char *what() const throw(); };
The <stdexcept> header provides a small hierarchy of exception classes that can be thrown or caught:
exceptionlogic_errordomain_errorinvalid_argumentlength_errorout_of_rangeruntime_errorrange_erroroverflow_errorunderflow_error
Logic errors are thrown if the program has internal errors that are caused by the user of a function and that, in theory, are preventable.
Runtime errors are thrown if the cause is beyond the program and can't be predicted by the user of a function.