Skip to content
UPEEC

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.

Intermediate
Comments 0

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).

Easy♥ 0🔖 0💬 0

std::array

A fixed-size array with value semantics and STL interface — no heap.

Beginner♥ 0🔖 0💬 0

std::deque

Double-ended queue: fast insert/remove at both ends.

Easy♥ 0🔖 0💬 0

std::list

Doubly linked list: O(1) insert/erase anywhere given an iterator, no random access.

Easy♥ 0🔖 0💬 0

std::forward_list

Singly linked list with minimal memory overhead.

Intermediate♥ 0🔖 0💬 0

std::stack

LIFO adaptor: `push`, `pop`, `top`.

Beginner♥ 0🔖 0💬 0

std::queue

FIFO adaptor: `push`, `pop`, `front`.

Beginner♥ 0🔖 0💬 0

std::priority_queue

A heap: `top()` is always the largest (or smallest with `std::greater`).

Easy♥ 0🔖 0💬 0

std::set and std::multiset

Sorted collections of unique (set) or repeated (multiset) keys — balanced trees, O(log n).

Easy♥ 0🔖 0💬 0

std::multimap

Sorted key → value pairs where keys can repeat.

Easy♥ 0🔖 0💬 0

std::unordered_set

Hash set: average O(1) insert and lookup, no order.

Easy♥ 0🔖 0💬 0

Iterators

Generalised pointers that connect containers and algorithms.

Easy♥ 0🔖 0💬 0

Ranges

C++20 algorithms that take whole containers and compose lazily.

Intermediate♥ 0🔖 0💬 0

Views

Lazy, composable range adaptors.

Intermediate♥ 0🔖 0💬 0

std::string

Owning, growable text string.

Beginner♥ 0🔖 0💬 0

std::string_view

A non-owning view of characters — cheap to pass, no copy.

Intermediate♥ 0🔖 0💬 0

Streams

`iostream`, `fstream`, `stringstream` — type-safe formatted I/O.

Easy♥ 0🔖 0💬 0

std::filesystem

Paths, directories and file operations (C++17).

Easy♥ 0🔖 0💬 0

std::chrono

Type-safe durations, clocks and time points.

Easy♥ 0🔖 0💬 0

std::optional

A value that may or may not be present.

Easy♥ 0🔖 0💬 0

std::variant

A type-safe union holding one of several types.

Intermediate♥ 0🔖 0💬 0

std::any

Holds a value of any copyable type, checked at run time with `any_cast`.

Intermediate♥ 0🔖 0💬 0

std::tuple

A fixed-size collection of heterogeneous values.

Easy♥ 0🔖 0💬 0

std::bitset

A fixed-size sequence of bits with convenient operations.

Easy♥ 0🔖 0💬 0

std::regex

Regular expressions in the standard library.

Intermediate♥ 0🔖 0💬 0

random

Random engines and distributions.

Easy♥ 0🔖 0💬 0

Numerics Library

`<numeric>`, `<cmath>`, `<complex>`, `<numbers>`, `<bit>`: accumulate, gcd, lcm, complex numbers, π, popcount.

Intermediate♥ 0🔖 0💬 0

std::span

A non-owning view over a contiguous sequence (C++20).

Intermediate♥ 0🔖 0💬 0

std::expected

Holds either a value or an error (C++23) — error handling without exceptions.

Intermediate♥ 0🔖 0💬 0

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.