Modern Template Techniques (C++17)
Volume 1 covered the "mechanics" of templates: the compilation model, specialization, CRTP. This part picks up from there with the modern tools C++17 brought to template engineering: if constexpr lets a template dispatch by type without leaning on a stack of overloads, variadic templates handle any number of arguments, perfect forwarding lets a generic factory pass arguments through exactly as they arrived, and CTAD saves you from typing out a string of angle brackets. At the end, a type-safe any welds these tools together.
One arrangement to flag up front: the classic TMP tricks — type traits, SFINAE, void_t, fold expressions — live in the vol3 metaprogramming sub-volume, in the "TMP Core Techniques" piece (the forerunner of concepts), and this part doesn't repeat them.
The companion runnable examples live at code/examples/vol4/vol2-modern-cpp17/; every file runs directly with g++ -std=c++17 xxx.cpp.
Pieces 01 through 05 are the spine of the C++17 template line: 01 opens with if constexpr, making clear why compile-time branching can replace a stack of overloads; 02 takes the parameter-pack expansion mechanism apart (recursion, if constexpr termination, and fold expressions, three styles compared side by side); 03 covers perfect forwarding and reference collapsing — machinery no generic factory can dodge; 04 is CTAD, how the compiler back-deduces template arguments from constructor arguments; 05 ties the previous four together with a hand-written type-safe any. Pieces 06 through 08 are a few other modern features in this volume (designated initializers and Ranges); they are earlier in style and don't fully match how 01 through 05 are written — a cleanup left for later.