Chapter 3. A Deeper Look at Metafunctions
With the foundation laid so far, we’re ready to explore one of the most basic uses for template metaprogramming techniques: adding static type checking to traditionally unchecked operations. We’ll look at a practical example from science and engineering that can find applications in almost any numerical code. Along the way you’ll learn some important new concepts and get a taste of metaprogramming at a high level using the MPL.
The first rule of doing physical calculations on paper is that the numbers being manipulated don’t stand alone: most quantities have attached dimensions, to be ignored at our peril. As computations become more complex, keeping track of dimensions is what ...