Chapter 7: Patterns and Idioms
The previous parts of the book were designed to help you learn everything about templates, from the basics to the most advanced features, including the latest concepts and constraints from C++20. Now, it is time for us to put this knowledge to work and learn about various metaprogramming techniques. In this chapter, we will discuss the following topics:
- Dynamic versus static polymorphism
- The Curiously Recurring Template Pattern (CRTP)
- Mixins
- Type erasure
- Tag dispatching
- Expression templates
- Typelists
By the end of the chapter, you will have a good understanding of various multiprogramming techniques that will help you solve a variety of problems.
Let’s start the chapter by discussing the two forms of polymorphism: dynamic and static.