C++ Standard Library

C++ Standard Library

C++ standard headers, major facilities, and the main types, algorithms, and utilities you will look up repeatedly.

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.

C++ Standard Library

Scope note

The C++ standard library is too large to present every overload, member function, customization point, and trait specialization on one page without turning the page into noise. This page is now a hub that points to the main library families and the dedicated header index.

Start here

Core language support and utilities

<utility>, <type_traits>, <typeinfo>, <compare>, <concepts>

<tuple>, <optional>, <variant>, <any>, <expected>

<functional>

Strings, text, and formatting

<string>, <string_view>, <charconv>, <format>, <print>

<regex> and <locale>

Iterators, ranges, and algorithms

For a more focused algorithms and lazy-pipeline reference, see C++ algorithms and ranges.

<iterator> and <ranges>

<algorithm> and <numeric>

Containers and views

For a denser container-by-container summary, see C++ containers and views.

Sequence containers

Associative and unordered containers

Adapters and views

Memory and resource management

<memory> and friends

<new>

I/O and filesystems

<iostream>, <istream>, <ostream>, <fstream>, <sstream>

<filesystem>

Time, random, math, and numerics

For time, random, and math facilities grouped together, see C++ numerics and time.

<chrono>

<random>

<numbers>, <ratio>, <complex>, <valarray>, <cmath>

Concurrency and atomics

For threads, atomics, futures, semaphores, latches, and barriers on one page, see C++ concurrency library.

<thread>, <mutex>, <shared_mutex>, <condition_variable>

<future>, <atomic>, <semaphore>, <barrier>, <latch>

Errors, diagnostics, and source information

<exception>, <stdexcept>, <system_error>, <source_location>

C compatibility headers in C++

Many C headers are available in c-prefixed form with names in namespace std, including:

Practical lookup strategy

  1. Start by identifying the right header family.
  2. Narrow from a facility family to the specific type or algorithm.
  3. Confirm iterator, ownership, exception, and complexity guarantees before adopting it in production code.

Nearby reference pages

Example in practice

#include <vector>
#include <algorithm>

int main() {
    std::vector<int> values{4, 1, 3, 2};
    std::sort(values.begin(), values.end());
}