Debugging Templates

As TMP code induces the compiler to perform calculations, it’s virtually impossible to follow it step by step. However, there are some techniques that can help. This chapter in fact contains a mix of pieces of advice and debugging strategies.

11.1. Identify Types

Modern debuggers will always show the exact type of variables when the program is stopped. Moreover, a lot of information about types is visible in the call stack, where (member) functions usually are displayed with their full list of template arguments. However, you’ll often need to inspect intermediate results and return types.

The following function ...

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.