|
C++ Template Metaprogramming
Solutions to the exercises throughout the book
|
"Adding static type checking to traditionally unchecked operations." More...
Modules | |
| Exercise 3-0 | |
| Redefine the binary template to sanity-check its parameter. | |
| Exercise 3-1 | |
| Transform a vector by adding 1 to all its elements. | |
| Exercise 3-2 | |
| Square all elements in a sequence. | |
| Exercise 3-3 | |
| Manipulate pointers with the twice metafunction. | |
| Exercise 3-4 | |
| Iteratively call twice to add pointers to a type. | |
| Exercise 3-5 | |
| Add multiplication and division that honors units of measurement. | |
| Exercise 3-6 | |
| Rewrite twice as a lambda. | |
| Exercise 3-8 | |
| Add the ability to specify units. | |
Files | |
| file | chapter-3-twice.hpp |
Define the twice metafunction for use in multiple exercises. | |
| file | chapter-3.cpp |
| Test application for Chapter 3. | |
Namespaces | |
| namespace | chapter3 |
| Provide utilities availble to all Chapter 3 solutions. | |
"Adding static type checking to traditionally unchecked operations."
C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond.