- Won't talk about preprocessor tricks
- Topic is very deep! To drill further, consult one or more of these books:
- 2001: Modern C++ Design: Generic Programming and Design Patterns Applied by Andrei Alexandrescu
- 2004: C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond by David Abrahams and Aleksey Gurtovoy
- 2017: C++ Templates: The Complete Guide (2nd Edition) by David Vandevoorde, Nicolai M. Josuttis, Douglas Gregor
- Template Review
- Template expansion
- Function Template
- Class Template
- Alias Template
- Variable Template
- Template Parameters
- Type parameters
- Non-type parameters
- Template parameters
- "Substitution Failure Is Not An Error" SFINAE
- Specializations of templates: full and partial
- Examples
- Template function example
- Template class example
- Policy based design
- std::type_traits to choose implementations
- tag dispatching
- decltype for function return values
- decltype for template parameters
- contexpr values and functions
- if constexpr
- Parameter packs
- Fold expressions
- auto template parameters
- Compile-time programming is replacing domain-specific code generators (lex, yacc, MIDL, Qt moc)
- CopperSpice replaced Qt moc with compile-time templates
- compile-time regex with example
- CppCon 2017 talk
constexpr
all the things! compile-time JSON example - boost.spirit for parsing
- Kvasir for embedded development (GBA revisited) slides 1, slides 2