Small Object Toolkit

The previous chapter focused on the connection between template programming and style. In short, templates are elegant, as they allow you to write efficient code that looks simple because they hide the underlying complexity.

If you recall the introductory example of sq from Chapter 1, it’s clear that the first problem of TMP is choosing the best C++ entity that models a concept and makes the code look clear at the point of instantiation.

Most classic functions use internally temporary variables and return a result. Temporary variables are cheap, so you must give the intermediate results a name to increase the readability ...

Get Advanced Metaprogramming in Classic C++ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.