Building the template metaprogramming
Before we go further in the template metaprogramming discussion, it's better if we discuss the skeleton that builds the template metaprogramming. There are four factors that form the template metaprogramming--type, value, branch, and recursion. In this topic, we will dig into the factors that form the template.
Adding a value to the variable in the template
At the beginning of this chapter, we discussed the concept of metafunction when we talked about the macro preprocessor. In the macro preprocessor, we explicitly manipulate the source code; in this case, the macro (metafunction) manipulates the source code. In contrast, we work with types in C++ template metaprogramming. This means the metafunction is a function that works with types. So, the better approach to use template metaprogramming is working with type parameters only when possible. When we are talking about the variables in template metaprogramming, it's actually not a variable since the value...