Skip to content
C++

Containers

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

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
std::array

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

C++11
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::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