Standard Library Standard Library Standard Library
Containers
Sequence
doubly-linked list; O(1) insert, erase & splicing; in practice often slower than vector
singly-linked list; O(1) insert, erase & splicing; needs less memory than list
;
in practice often slower than vector
Associative
Containers that allow non-unique keys:
multiset
multimap
unordered_multiset
unordered_multimap
Special
pair<A,B>
contains 2 values of same or different type
tuple<A,B,C,…>
contains many values of same or different type
optional<T>
contains either one value of type T or no value
variant<A,B,C,…>
contains one value of either type A or type B or type C, …
any
contains one value of any
Views C++17
Contiguous Sequence Views
- lightweight (= cheap to copy, can be passed by value)
- non-owning (= not responsible for allocating or deleting memory)
string_view
C++17
view of a string-like character sequence
Composable Range Views C++20
Algorithms
Introductory Articles
Usage Examples by Category
- Minimum / Maximum
- Existence Queries (
count
,any_of
, …) - Finding Elements (
find
,find_if
, …) - Comparing Ranges (
equal
,mismatch
, …) - Sequence Reordering (
reverse
,rotate
, …) - Changing Elements (
replace
,transform
, …) - Numeric Algorithms (
accumulate
,iota
, …) - Sorted Sequence Operations (
binary_search
, …) - Random Number Generation