std::exception(3)

std::exception3

Base class for all library exceptions.

Usage

#include <exception>

Inherited by , , , , __gnu_cxx::forced_error, __gnu_cxx::recursive_init_error, std::bad_alloc, std::bad_cast, std::bad_exception, and std::bad_function_call.

Public Member Functions

_GLIBCXX26_CONSTEXPR exception (const exception &)=default
_GLIBCXX26_CONSTEXPR exception (exception &&)=default
_GLIBCXX26_CONSTEXPR exception & operator= (const exception &)=default
_GLIBCXX26_CONSTEXPR exception & operator= (exception &&)=default
virtual constexpr const char * what () const noexcept

Detailed Description

Base class for all library exceptions.

This is the base class for all exceptions thrown by the standard library, and by certain language expressions. You are free to derive your own exception classes, or use a different hierarchy, or to throw non-class data (e.g., fundamental types).

Member Function Documentation

virtual constexpr const char * std::exception::what () const [inline], [constexpr], [virtual], [noexcept]

Returns a C-style character string describing the general cause of the current error.

Reimplemented in std::bad_alloc, std::bad_cast, std::bad_exception, std::bad_function_call, std::bad_typeid, std::bad_weak_ptr, std::experimental::filesystem::v1::filesystem_error, std::experimental::fundamentals_v1::bad_any_cast, std::filesystem::filesystem_error, std::future_error, std::ios_base::failure, std::logic_error, and std::runtime_error.

Releases

4 releases since Debian 3.1 (Sarge); the text changed 3 times.

  1. 3.1
  2. 4.0
  3. 5.0
  4. Arch

Author

Generated automatically by Doxygen for libstdc++ from the source code.

From gcc 16.2.1+r23+gd564253eb6c8-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.