Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Front Page / Tutorial: Metafunctions and Higher-Order Metaprogramming

Tutorial: Metafunctions and Higher-Order Metaprogramming

Note:The following material is an excerpt from Chapter 3 of "C++ Template Metaprogramming", by David Abrahams and Aleksey Gurtovoy, ISBN 0321227255, Copyright (c) 2005 by Pearson Education, Inc. Reprinted with permission.

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.