Zum Inhalt springen

C++-Referenz/ Standardbibliothek/ Ausnahmen

Aus Wikibooks
Alte Seite

Die Arbeit am Buch »C++-Referenz« wurde vom Hauptautor eingestellt. Ein Lehrbuch zum Thema C++ ist unter »C++-Programmierung« zu finden. Eine sehr umfangreiche und gute Referenz gibt es unter cppreference.com.

Diese Seite beschreibt C++98, einen stark veralteten Standard. Aktuelle Referenz.

Klassenhierarchie der C++-Ausnahmen

exception

[Bearbeiten]
// Header: exception
class exception {
public:
    exception() throw();
    exception(exception const&) throw();
    exception& operator=(exception const&) throw();
    virtual ~exception() throw();
    virtual char const* what() const throw();
};

bad_exception

[Bearbeiten]
// Header: exception
class bad_exception: public exception {
public:
    bad_exception() throw();
    bad_exception(bad_exception const&) throw();
    bad_exception& operator=(bad_exception const&) throw();
    virtual ~bad_exception() throw();
    virtual char const* what() const throw();
};

bad_cast

[Bearbeiten]
// Header: typeinfo
class bad_cast: public exception {
public:
    bad_cast() throw();
    bad_cast(bad_cast const&) throw();
    bad_cast& operator=(bad_cast const&) throw();
    virtual ~bad_cast() throw();
    virtual char const* what() const throw();
};

bad_typeid

[Bearbeiten]
// Header: typeinfo
class bad_typeid: public exception {
public:
    bad_typeid() throw();
    bad_typeid(bad_typeid const&) throw();
    bad_typeid& operator=(bad_typeid const&) throw();
    virtual ~bad_typeid() throw();
    virtual char const* what() const throw();
};

bad_alloc

[Bearbeiten]
// Header: new
class bad_alloc: public exception {
public:
    bad_alloc() throw();
    bad_alloc(bad_alloc const&) throw();
    bad_alloc& operator=(bad_alloc const&) throw();
    virtual ~bad_alloc() throw();
    virtual char const* what() const throw();
};

ios_base::failure

[Bearbeiten]
// Header: ios
class ios_base::failure: public exception {
public:
    explicit failure(const string& msg);
    virtual ~failure();
    virtual char const* what() const;
};

logic_error

[Bearbeiten]
// Header: stdexcept
class logic_error: public exception {
public:
    logic_error(string const& what_arg);
};

domain_error

[Bearbeiten]
// Header: stdexcept
class domain_error: public logic_error {
public:
    domain_error(string const& what_arg);
};

invalid_argument

[Bearbeiten]
// Header: stdexcept
class invalid_argument: public logic_error {
public:
    invalid_argument(string const& what_arg);
};

length_error

[Bearbeiten]
// Header: stdexcept
class length_error: public logic_error {
public:
    length_error(string const& what_arg);
};

out_of_range

[Bearbeiten]
// Header: stdexcept
class out_of_range: public logic_error {
public:
    out_of_range(string const& what_arg);
};

runtime_error

[Bearbeiten]
// Header: stdexcept
class runtime_error: public exception {
public:
    runtime_error(string const& what_arg);
};

range_error

[Bearbeiten]
// Header: stdexcept
class range_error: public runtime_error {
public:
    range_error(string const& what_arg);
};

overflow_error

[Bearbeiten]
// Header: stdexcept
class overflow_error: public runtime_error {
public:
    overflow_error(string const& what_arg);
};

underflow_error

[Bearbeiten]
// Header: stdexcept
class underflow_error: public runtime_error {
public:
    underflow_error(string const& what_arg);
};