Meta-Programs are programs on programs. Reading a program as a text file and performing certain transformations on it is certainly feasible in most programming languages. In C++, we can even write programs that compute during compilation or transform themselves. Todd Veldhuizen showed that the template type system of C++ is Turing-complete . This means that everything computable can be calculated in C++ at compile time.
We will discuss this intriguing asset thoroughly in this chapter. In particular, we will look at three major applications of it:
• Compile-time calculations (§5.1);
• Information about and transformations of types (§5.2); and
These techniques allow us to make the examples ...