The C++ Textbook
Search
/
Start here
Practice problems
Quick reference
Progress
Part 1
Foundations
1.1
Hello, machine
1.2
Values, types, and names
1.3
Making decisions
1.4
Repetition
1.5
Functions
1.6
Your toolchain
Part 2
Memory and objects
2.1
Objects and storage
2.2
Pointers
2.3
References
2.4
Lifetime and scope
2.5
The stack and the heap
2.6
Arrays, and why they decay
2.7
const and constness
Part 3
Types you make
3.1
Structs and classes
3.2
RAII
3.3
Copying
3.4
Moving
3.5
Rule of zero, three, five
3.6
Operator overloading
3.7
Inheritance and virtual functions
3.8
When not to use inheritance
Part 4
The standard library
4.1
std::string and text
4.2
Sequence containers
4.3
Associative containers
4.4
Iterators
4.5
Algorithms
4.6
Ranges and views
4.7
Smart pointers
4.8
optional, variant, expected
4.9
Input, output, formatting
Part 5
Generic programming
5.1
Function templates
5.2
Class templates
5.3
Deduction and forwarding
5.4
Concepts and constraints
5.5
Compile-time computation
5.6
Variadic templates
5.7
Type traits
5.8
Static polymorphism
Part 6
Correctness
6.1
Exceptions
6.2
Error handling without exceptions
6.3
Undefined behaviour
6.4
Testing
6.5
Debugging
6.6
Invariants and assertions
Part 7
Performance
7.1
What the compiler does
7.2
Measuring
7.3
Cache and layout
7.4
Zero-cost, examined
7.5
Copies and elision
7.6
Inlining and linking
Part 8
Concurrency
8.1
Threads
8.2
Races and mutexes
8.3
Atomics
8.4
Futures and tasks
8.5
Coroutines
Part 9
Building real software
9.1
Translation units
9.2
Modules
9.3
Build systems
9.4
Dependencies
9.5
Project: search index
Part 10
Problem solving
10.1
Reading a problem
10.2
Counting the work
10.3
Template and fast I/O
10.4
Sorting and comparators
10.5
Binary search
10.6
Two pointers
10.7
Prefix sums
10.8
Monotonic stacks
10.9
Monotonic deques
10.10
Hashing and counting
10.11
Recursion
10.12
Bitmasks
10.13
Greedy
10.14
Divide and conquer
10.15
Meet in the middle
10.16
Representing graphs
10.17
BFS
10.18
DFS
10.19
Topological order
10.20
Union-Find
10.21
Dijkstra
10.22
Negative weights
10.23
Spanning trees
10.24
Tree DP
Practice
· Core
Two caches that remember too much