C++ Standard Library headers
Curated entry point for C++ library headers: choose by task, library family, or standard version instead of scanning a flat list.
The C++ standard library is delivered through headers, but most readers do not start from a raw alphabetical list. This page groups headers by job, library family, and standard version so you can move from a task to the right include quickly.
# Start By Task
Store and traverse data
Containers, iterator entry points, views, and lightweight object wrappers used to move data through generic code.
Search, transform, and compute
Generic algorithms, reductions, random engines, numeric helpers, chrono, and newer math-oriented facilities.
<algorithm> · <numeric> · <random> · <chrono>
Process text and I/O
Strings, formatting, streams, filesystems, regex, locale, and newer text encoding facilities.
<string> · <format> · <filesystem> · <regex>
Build vocabulary and support types
Pairs, tuples, optionals, variants, callable wrappers, type traits, concepts, and other language support utilities.
Manage memory and lifetime
Allocation primitives, smart pointers, allocators, polymorphic memory resources, and uninitialized storage helpers.
Coordinate threads and shared state
Thread creation, atomics, locks, futures, stop tokens, barriers, semaphores, and newer low-level concurrency building blocks.
<thread> · <atomic> · <mutex> · <stop_token>
# Quick Map
| If you need to... | Start with | Common headers | Related section |
|---|---|---|---|
| Own, index, or organize collections | Sequence and associative containers | <vector>, <deque>, <map>, <unordered_map>, <flat_map> | Containers |
| Express non-owning views over data | Ranges and span-like interfaces | <span>, <string_view>, <ranges>, <mdspan> | Ranges, Strings |
| Search, sort, compare, or reduce values | Generic algorithms and numeric helpers | <algorithm>, <numeric>, <execution>, <functional> | Algorithms, Numerics |
| Format, parse, or stream text | String and I/O facilities | <string>, <format>, <print>, <iostream>, <spanstream> | I/O, Text |
| Work with files, paths, and OS-facing text | Filesystem and locale-aware processing | <filesystem>, <fstream>, <locale>, <codecvt>, <text_encoding> | Filesystem, Locale |
| Represent optional, variant, or error-carrying values | Vocabulary types | <optional>, <variant>, <any>, <expected> | Utility, Diagnostics |
| Share work across threads | Thread and synchronization facilities | <thread>, <mutex>, <future>, <barrier>, <semaphore> | Thread support, Atomic operations |
# Header Families
| Family | Representative headers | Use this family for |
|---|---|---|
| Language support and traits | <type_traits>, <typeindex>, <typeinfo>, <concepts>, <compare> | Compile-time inspection, constraints, type relationships, and comparison categories. |
| Utilities and vocabulary types | <utility>, <tuple>, <optional>, <variant>, <expected> | Pairs, tuples, monadic-style value wrappers, and common glue types used across the library. |
| Containers and storage | <vector>, <list>, <map>, <unordered_map>, <inplace_vector> | Owning data structures and their specialized storage/performance tradeoffs. |
| Iterators, views, and ranges | <iterator>, <span>, <string_view>, <ranges>, <mdspan> | Non-owning traversal, iterator categories, lazy views, and multidimensional data access. |
| Algorithms and callable support | <algorithm>, <execution>, <functional> | Generic processing, projections/predicates, comparison helpers, and policy-based execution. |
| Numerics and random | <numeric>, <cmath>, <complex>, <random>, <linalg>, <simd> | Arithmetic building blocks, statistics/randomness, complex numbers, and newer high-performance numeric APIs. |
| Text, formatting, and I/O | <string>, <format>, <print>, <istream>, <spanstream> | String storage, formatting/parsing, stream APIs, and textual presentation. |
| Filesystem, locale, and regex | <filesystem>, <locale>, <regex>, <text_encoding> | Paths, internationalization, pattern matching, and text encoding metadata. |
| Memory management | <new>, <memory>, <scoped_allocator>, <memory_resource> | Dynamic allocation, allocator models, smart pointers, and polymorphic memory resources. |
| Concurrency and diagnostics | <thread>, <atomic>, <future>, <debugging>, <stacktrace>, <stop_token> | Shared-state concurrency, synchronization, task results, cancellation, and runtime debugging support. |
| C compatibility surface | <cstdio>, <cstdlib>, <cstring>, <cmath>, <cassert> | Standard C library facilities exposed through the C++ header model, usually in namespace std. |
# Headers Added In Newer Standards
| Standard | Notable headers | What changed |
|---|---|---|
| C++11 | <array>, <chrono>, <condition_variable>, <forward_list>, <future>, <random>, <regex>, <thread>, <type_traits>, <unordered_map> | Modernized the library baseline with concurrency, type traits, chrono, regex, and unordered containers. |
| C++14 | <shared_mutex> | Added shared locking primitives. |
| C++17 | <any>, <charconv>, <execution>, <filesystem>, <memory_resource>, <optional>, <string_view>, <variant> | Added vocabulary types, filesystem, string views, text conversion, and parallel algorithm support. |
| C++20 | <barrier>, <bit>, <compare>, <concepts>, <format>, <latch>, <ranges>, <semaphore>, <source_location>, <stop_token>, <syncstream> | Brought concepts, ranges, richer synchronization, formatting, and better low-level utility support. |
| C++23 | <expected>, <flat_map>, <flat_set>, <generator>, <mdspan>, <print>, <spanstream>, <stacktrace> | Added modern error transport, new flat containers, coroutine generator support, and improved output APIs. |
| C++26 | <debugging>, <hazard_pointer>, <inplace_vector>, <linalg>, <rcu>, <simd>, <text_encoding> | Extends the library with low-level concurrent reclamation, fixed-capacity containers, numerics, SIMD, and encoding metadata. |
# Include, Import, And Modules
| Model | Form | Choose it when |
|---|---|---|
| Classic include | #include <vector> | You need the most portable and currently most universal way to access library declarations. |
| Header unit import | import <vector>; | Your toolchain supports importing library headers as header units and you are already using modules-aware builds. |
| Named library module | import std; or import std.compat; | You want the standardized library module surface instead of importing many separate headers one by one. |
std.compat corresponds to the compatibility-oriented surface that also makes the C-library-derived names available in the traditional way. For most current codebases, headers remain the baseline entry point even if module support is being introduced incrementally.
# C Compatibility Headers
The c... headers are the C++ wrappers around the C standard library. They are usually the preferred spelling in C++ code because they fit the C++ header model and commonly provide declarations in namespace std.
| C++ header | Legacy C name | Typical use |
|---|---|---|
<cstdio> | <stdio.h> | FILE-based I/O, formatted printing, and stream-like C APIs. |
<cstdlib> | <stdlib.h> | Conversion, allocation, process control, and miscellaneous runtime utilities. |
<cstring> | <string.h> | Byte-string manipulation and memory block operations. |
<cmath> | <math.h> | Mathematical functions and classification utilities. |
<cassert> | <assert.h> | Assertions controlled by NDEBUG. |