Compile-time programming with Boost
Templates allow us to write C++ code that is independent of specific types of operands and can thus work unchanged with a large family of types. We can create both function templates and class templates (or struct templates), which take type parameters, nontype parameters (like constant integers), as well as template parameters. When a specialization of a class template is instantiated, member functions that are not directly or indirectly called are never instantiated.
The power of C++ templates goes beyond the ability to write generic code though. C++ templates are a powerful computation subsystem using which we can introspect C++ types, glean their properties, and write sophisticated recursive and branching ...
Get Learning Boost C++ Libraries 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.