Chapter 8. Diagnostics

Because C++ metaprograms are executed during compilation, debugging presents special challenges. There’s no debugger that allows us to step through metaprogram execution, set breakpoints, examine data, and so on—that sort of debugging would require interactive inspection of the compiler’s internal state. All we can really do is wait for the process to fail and then decipher the error messages it dumps on the screen. C++ template diagnostics are a common source of frustration because they often have no obvious relationship to the cause of the error and present a great deal more information than is useful. In this chapter we’ll discuss how to understand the sort of errors metaprogrammers typically encounter, and even how ...

Get C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.