Appendix C. Compile-Time Performance

Interpretation of template metaprograms is inherently inefficient. When a class template is instantiated, a C++ compiler must meet all the standard’s requirements, including matching against partial specializations, building an internal representation of the class, and recording the specialization in the template’s namespace. It may also have to meet requirements imposed by its own design or that of the environment, such as generating mangled symbol names for the linker or recording information for the debugger. None of these activities are directly related to the metaprogram’s intended computation.

This inefficiency manifests itself in the time it takes for a program to compile and in the resources used ...

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.