STL and the C++ Standard Library
Containers, iterators, algorithms, ranges and utility types. vector, map/unordered_map and STL algorithms have their own pages earlier in this subject.
This is an overview — pick a sub-topic below.
Sub-topics (31)
STL Containers Overview
Sequence containers (vector, deque, list), associative (set, map), unordered (hash) and adaptors (stack, queue).
std::array
A fixed-size array with value semantics and STL interface — no heap.
std::deque
Double-ended queue: fast insert/remove at both ends.
std::list
Doubly linked list: O(1) insert/erase anywhere given an iterator, no random access.
std::forward_list
Singly linked list with minimal memory overhead.
std::stack
LIFO adaptor: `push`, `pop`, `top`.
std::queue
FIFO adaptor: `push`, `pop`, `front`.
std::priority_queue
A heap: `top()` is always the largest (or smallest with `std::greater`).
std::set and std::multiset
Sorted collections of unique (set) or repeated (multiset) keys — balanced trees, O(log n).
std::multimap
Sorted key → value pairs where keys can repeat.
std::unordered_set
Hash set: average O(1) insert and lookup, no order.
Iterators
Generalised pointers that connect containers and algorithms.
Ranges
C++20 algorithms that take whole containers and compose lazily.
Views
Lazy, composable range adaptors.
std::string
Owning, growable text string.
std::string_view
A non-owning view of characters — cheap to pass, no copy.
Streams
`iostream`, `fstream`, `stringstream` — type-safe formatted I/O.
std::filesystem
Paths, directories and file operations (C++17).
std::chrono
Type-safe durations, clocks and time points.
std::optional
A value that may or may not be present.
std::variant
A type-safe union holding one of several types.
std::any
Holds a value of any copyable type, checked at run time with `any_cast`.
std::tuple
A fixed-size collection of heterogeneous values.
std::bitset
A fixed-size sequence of bits with convenient operations.
std::regex
Regular expressions in the standard library.
random
Random engines and distributions.
Numerics Library
`<numeric>`, `<cmath>`, `<complex>`, `<numbers>`, `<bit>`: accumulate, gcd, lcm, complex numbers, π, popcount.
std::format and std::print
Python-style formatting (C++20) and printing (C++23).
std::span
A non-owning view over a contiguous sequence (C++20).
std::expected
Holds either a value or an error (C++23) — error handling without exceptions.
Coroutines in the Standard Library
Functions that can suspend and resume (`co_await`, `co_yield`, `co_return`).
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.