All Standard Exceptions

All Standard Exceptions

A compact scan page for the main standard C++ exception types, error-code types, and adjacent failure-reporting facilities.

How to use this reference page

Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.

  • Scan the top of the page first to identify the primary types, functions, or algorithm families involved.
  • Use the nearby-page links when your question is really about a companion header, related algorithm family, or broader subsystem.
  • Validate tricky behavior with a small compileable example before relying on memory for details like invalidation, ordering, allocation, or lifetime rules.

All Standard Exceptions

Use this page as a fast scan. For grouped explanations, see Standard exceptions and errors.

Core exception bases

Logic error family

Runtime error family

Allocation, RTTI, and cast failures

Callable and vocabulary-type failures

Error-code support types

Exception transport helpers

Adjacent C facilities

Practical split

Small worked example

#include <optional>
#include <stdexcept>

int require_count(std::optional<int> count) {
	if (!count) {
		throw std::invalid_argument{"count was missing"};
	}
	if (*count < 0) {
		throw std::out_of_range{"count must be non-negative"};
	}
	return *count;
}

The useful habit is choosing the exception family by contract. Invalid caller input often maps to invalid_argument; broken bounds or indexing often map to out_of_range; system or environment failures often land in runtime_error or more specific derived types.

Fast exception-choice habit

Example in practice

#include <optional>
#include <stdexcept>

int require_value(std::optional<int> value) {
    if (!value) {
        throw std::invalid_argument{"missing value"};
    }
    return *value;
}

int main() {
    return require_value(42);
}