July 2015
Intermediate to advanced
558 pages
13h 31m
English
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 ...
Read now
Unlock full access