Skip to content

Template Basics (C++11-14)

C++ templates are the core mechanism of generic programming. This part moves from "using templates" to "writing libraries, reading STL source," covering the compilation model, specialization and partial specialization, non-type parameters, two-phase name lookup, hidden friends, alias templates, and CRTP, finally welding the first nine pieces together with a fixed_vector<T, N> project.

Runnable examples live in code/examples/vol4/vol1-basics-cpp11-14/: the four most reusable ones (fixed_vector, CRTP static polymorphism, the Comparable mixin, and type_traits from scratch), each compiles with g++ -std=c++20 xxx.cpp.

v0.10.0-6-gbcee94e · bcee94e · 2026-08-20