Skip to content
C++

Containers

19 container reference pages — sequence, associative, unordered, and flat containers.

Container Adaptors

Wrapper classes that restrict and redefine the interface of sequence containers to model stacks, queues, and priority queues.

C++98
deque, list, queue, stack, priority_queue

"Sequential containers and adaptors: deque for double-ended operations, list for stable iterators, queue/stack/priority_queue adaptors. Choose based on insertion pattern and iterator requirements."

C++98
Iterator Invalidation

Rules governing when container operations cause previously-obtained iterators, pointers, and references to become undefined to dereference.

List

Doubly-linked list container optimized for efficient insertion and removal at any position

C++98
std::array

Fixed-size contiguous array wrapper with value semantics, bounds checking, and full STL compatibility.

C++11
std::deque

Double-ended queue supporting fast insertion and deletion at both ends with random access

C++98
std::flat_map

C++23 sorted associative container adaptor storing key-value pairs contiguously, giving map semantics with cache-friendly sequential layout.

C++23
std::flat_set and std::flat_map (C++23)

Sorted associative container adapters backed by contiguous storage — O(log n) binary search with cache-friendly memory layout, ideal for read-heavy workloads.

C++23
std::forward_list — Singly Linked List

C++ std::forward_list for singly-linked storage with O(1) front insertion, minimal memory per node, forward-only iteration, and when to use it over std::list.

C++11
std::hive

A C++26 sequence container providing O(1) insertion and erasure with stable iterators via a block-based, skipfield-backed memory layout.

C++26
std::map / std::unordered_map

std::map (sorted red-black tree, O(log n)) and std::unordered_map (hash table, O(1) avg): when to pick each, how to tune performance, and C++17/20/23 additions.

C++98
std::multimap and std::multiset

Ordered associative containers allowing duplicate keys — equal_range, node handles, erase semantics, and flat variants.

C++98
std::set and std::unordered_set

Ordered unique-element container backed by a red-black tree (set) and hash-table unique-element container (unordered_set) in C++.

C++98
std::span — Non-Owning Contiguous View

"C++20 std::span: a zero-overhead view over contiguous data. Fixed vs dynamic extent, subspans, byte reinterpretation, and API design patterns."

C++20
std::stack, std::queue, and std::priority_queue

C++ container adaptors — stack (LIFO), queue (FIFO), and priority_queue (heap-based) with underlying container selection, complexity, and practical patterns.

C++98
std::string

std::string — owning mutable character sequence with SSO, full modification API, searching, numeric conversions, and C++17/20/23 additions.

C++98
std::unordered_map

Hash map with O(1) average insert, lookup, and erase — the default associative container when key ordering is irrelevant.

C++11
std::vector

Dynamic contiguous array container. Default choice for sequential collections. O(1) random access and amortized O(1) append. Reallocates when capacity exhausted.

C++98
unordered_set and unordered_multiset

Hash-based sets with O(1) average lookup—custom hashing, rehashing, iterator invalidation, C++17/20 additions, and performance traps.

C++11