C++ Knowledge Base
A structured reference for modern C++ (C++17/20/23): from the toolchain that turns text into a binary, through the language and standard library, down to the memory model, ABI, and the tools you use to debug and profile. Pages favour why it behaves this way over syntax dumps, and link to each other instead of repeating themselves.
How this is organised
Three loose tiers: the foundation (Overview, Toolchain, Language Fundamentals), the language and library you write every day (Types through Standard Library), and the systems-level and tooling layers (Error Handling through Debugging). Each folder is a self-contained topic; follow the cross-links between them.
Sections
| Section | What it covers | |
|---|---|---|
| Overview | What C++ is, its philosophy, and the standard versions | |
| Toolchain & Build | Preprocess → compile → assemble → link, and the build tools around it | |
| Language Fundamentals | Syntax, expressions, operators, control flow | |
| Types & Values | Fundamental types, conversions, cv-qualifiers, value categories, type deduction | |
| Functions & Call Mechanics | Overloading, default args, inline, constexpr, noexcept, calling conventions | |
| Memory & Object Lifetime | Storage duration, initialization, new/delete, lifetime, aliasing | |
| Pointers, References & Smart Pointers | Raw vs smart pointers, unique_ptr, shared_ptr, weak_ptr | |
| Classes & OOP | Construction, copy/move, inheritance, polymorphism, layout | |
| Templates & Metaprogramming | Templates, deduction, SFINAE, concepts, traits, variadics | |
| Standard Library | Containers, iterators, algorithms, ranges, strings, chrono, filesystem | |
| Error Handling & Safety | Exceptions, the strong guarantee, error codes, assertions, contracts, UB | |
| Concurrency & Memory Model | The memory model, atomics, threads, mutexes, futures, pools | |
| Low-Level & Platform | ABI, object layout, padding, endianness, volatile, C interop | |
| Idioms & Design | RAII, PIMPL, CRTP, non-copyable, copy-and-swap, type erasure, policies | |
| Debugging & Profiling | GDB, core dumps, sanitizers, Valgrind, perf, reading assembly |
Suggested reading paths
- New to C++: Overview → Language Fundamentals → Types & Values → Classes & OOP → Standard Library. Enough to read and write real code.
- Coming from C: skim Overview and Language Fundamentals, then Memory & Object Lifetime, Smart Pointers and RAII — that's where C++ diverges most.
- Systems / performance: Toolchain, Memory, Concurrency, Low-Level & Platform and Debugging & Profiling.
Conventions used across these docs
- Code blocks compile against C++17 or later; version-specific features are tagged inline (e.g. (C++20)).
- Admonitions flag the important bits:
infofor context,tipfor guidance,warning/dangerfor foot-guns. - Diagrams are Mermaid; data tables prefer plain words over decorative symbols.