Translations of this page?:



The <exception> header provides functions and classes for exception control. One basic class is exception:

class exception
    exception() throw();
    exception(const exception&) throw();
    exception& operator=(const exception&) throw();
    virtual ~exception() throw();
    virtual const char *what() const throw();

Standard Exceptions

The <stdexcept> header provides a small hierarchy of exception classes that can be thrown or caught:

  • exception
    • logic_error
      • domain_error
      • invalid_argument
      • length_error
      • out_of_range
    • runtime_error
      • range_error
      • overflow_error
      • underflow_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.

• • • IndexRecent changesRSScc