C++ Mastery Curriculum Plan
Goal
Create a dependency-ordered C++ curriculum under learn_cpp/mastery/. Existing
lessons remain unchanged and are linked as supporting material. Core lessons use
C++20 and GCC 13. The std::expected example is the only C++23 target. Modules
remain conceptual.
Lesson contract
Every runnable lesson contains:
- 15–25 minutes of focused instruction;
- 2–4 runnable examples;
- a local
code/CMakeLists.txtusing warnings and CTest; - a compiling
exercise_starter.cpp; - predict-output, concept, find-the-bug, and coding-exercise questions;
- collapsible answers explaining the reasoning;
- prerequisites and completion criteria.
Lesson exercises include solutions. Phase missions provide requirements, hints, and acceptance tests but no complete solution.
Phase 1 — Tools and foundations
- Toolchain and debugging: preprocessing, compiler, assembler, linker, loader, translation units, headers, namespaces, ODR, GDB, and VS Code.
- Values and expressions: fundamental types, initialization, conversions, signed/unsigned behavior, operators, precedence, and short-circuiting.
- Control flow and functions: conditions, loops, scope, functions, return values, and overloads.
- Text and data modeling:
string,string_view,enum class, structures, and simple invariants.
Mission: build and debug a warning-free multi-file command-line text analyzer.
Phase 2 — STL mastery
- Iterators and algorithms.
- Containers, ordering, hashing, complexity, and invalidation.
- Vocabulary types:
optional,variant,tuple, andspan. filesystem,chrono, random engines, and distributions.
Mission: build a portable file-backed address book using standard algorithms and associative containers.
Phase 3 — Reliability and design
- Assertions, exceptions, error boundaries, explicit errors, and a marked
C++23
std::expectedexample. - Unit/integration tests, fixtures, fakes, and failure paths.
- Undefined behavior, sanitizers, clang-tidy, and clang-format.
- Composition, dependency injection, invariants, strong types, and practical SOLID principles.
Mission: harden the address book with tests, tools, logging, and fake storage.
Phase 4 — Generic programming
constexpr,consteval,constinit, type traits, concepts, and constraints.- Variadic templates, forwarding, and fold expressions.
- Ranges, views, projections, lazy evaluation, and lifetime hazards.
Mission: build a constrained generic statistics library.
Phase 5 — Concurrency
- Futures, promises,
async,jthread,stop_token, and cancellation. - Atomics, memory ordering, locking, deadlock, starvation, and contention.
- Bounded queues, worker pools, backpressure, shutdown, and parallel algorithms.
Mission: build and measure a bounded concurrent telemetry pipeline.
Phase 6 — Production engineering
- Dependency management, CMake install/export/package configuration, and API/ABI compatibility.
- Benchmarking and CPU, allocation, I/O, and contention profiling.
Mission: package a reusable library, consume it externally, benchmark it, and document one measured optimization.
Specializations
- Pure C++20 coroutines: coroutine frames,
promise_type,co_await,co_yield,co_return, a learningGenerator<T>, andTask<T>. - Conceptual C++20 modules: interfaces,
export module,import, and the difference from headers. No GCC 13 runnable project is required.
Networking is excluded until an asynchronous runtime library is selected.
Verification
- Build every normal example with GCC 13 in C++20 mode.
- Enable
-Wall -Wextra -Wpedanticand CTest from the first lesson. - Compile phase missions with GCC 13 and Clang 18.
- Test deterministic output plus invalid and failure paths.
- Introduce sanitizers in Phase 3 and ThreadSanitizer in Phase 5.
- Build MkDocs after every lesson and reject new page-specific warnings.
- Change syllabus status only after lesson examples, quiz, exercise, tests, and documentation validation are complete.