Skip to content

C++ Practice

Master RAII, move semantics, templates, and the STL.

ConceptDetails
Memory ModelRAII, smart pointers (unique_ptr, shared_ptr), stack preference
Type SystemStrong static typing, templates, concepts (C++20), auto
Error HandlingExceptions (use judiciously), std::expected (C++23), std::optional
Concurrencystd::thread, std::async, std::atomic, coroutines (C++20)
Buildcmake, g++/clang++, modules (C++20), header-only libraries
StandardC++20 (prefer) or C++23
  • RAII everywhere — destructors for cleanup, no manual delete
  • Move semantics — std::move, rvalue references, rule of five/zero
  • SFINAE / Concepts — constrain templates at compile time
  • Range-based for with structured bindings
  • std::variant + std::visit for sum types
  • CRTP (Curiously Recurring Template Pattern) for static polymorphism
  • constexpr for compile-time computation
  • cppreference.com — authoritative reference
  • ISO C++ FAQ — common questions
  • A Tour of C++ (Stroustrup, 3rd ed.) — concise modern overview
  • Effective Modern C++ (Scott Meyers) — essential C++11/14 patterns
  • C++ Core Guidelines — free, maintained by Stroustrup & Sutter
Terminal window
practice/bin/ol list build cpp # which of these have references yet
practice/bin/ol start build cpp 01 # clone it stubbed into .scratchpad/
practice/bin/ol check build cpp 01 # run it; exit code is the verdict
practice/bin/ol diff build cpp 01 # your attempt against the reference

Exercises are ordered by concept, not by difficulty, so pick by the stars rather than by the number. An exercise listed below with no reference yet is a row in this table and nothing more; see the practice path for how the harness works.

#ExerciseConceptsDifficulty
01Vector<T> (like std::vector)Templates, move semantics, allocator awareness⭐⭐⭐
02UniquePtr<T>RAII, move-only types, custom deleters⭐⭐
04Compile-time matrix (constexpr)constexpr, template metaprogramming⭐⭐⭐
05Thread-safe queuestd::mutex, std::condition_variable, move semantics⭐⭐⭐
06Expression template (lazy eval)CRTP, operator overloading, zero-cost abstractions⭐⭐⭐⭐
07Coroutine generatorC++20 coroutines, co_yield, lazy sequences⭐⭐⭐⭐
08std::function cloneType erasure, small buffer optimization⭐⭐⭐⭐
09Graph with conceptsC++20 concepts, ranges, BFS/DFS⭐⭐⭐
10Memory pool allocatorCustom allocator, placement new, alignment⭐⭐⭐⭐

Exercise 03 (hash map) is consolidated into the course: six hash maps across the drills became two course modules, ds.02 (Swiss table, C) and ds.05 (Robin Hood, Rust), whose chapters live in Systems Data Structures.