Chapter 2. Traits and Type Manipulation
We hope the numerical bias of Chapter 1 didn’t leave you with the impression that most metaprograms are arithmetic in nature. In fact, numeric computation at compile time is comparatively rare. In this chapter you’ll learn the basics of what is going to be a recurring theme: metaprogramming as “type computation.”
2.1 Type Associations
In C++, the entities that can be manipulated at compile time, called metadata, are divided roughly into two categories: types and non-types. Not coincidentally, all the kinds of metadata can be used as template parameters. The constant integer values used in Chapter 1 are among the non-types, a category that also includes values of nearly everything else that can be known ...