C++ Templates: The Complete Guide

David Vandevoorde / Nicolai M. Josuttis / DougLas Gregor  
Total pages
September 2017
Related Titles

Product detail

Product Price CHF Available  
C++ Templates: The Complete Guide
88.10 approx. 7-9 days


This book has become and will remain the 'bible' on templates. It provides the most complete and accurate information on using templates in C++. It is a complete reference as well as a tutorial. It includes real-world examples.


  • Updated to include the new C++0x features and rules
  • Previous coverage revised to reflect newer ideas
  • Added coverage of modern topics, such as lambdas, inline namespaces, user-defined literals, as tied to template applications
  • Qualities most praised in the 1e are maintained: includes lots of small, illustrative examples; explains lots of details not available elsewhere (and yet have to be dealt with all the time); explains related non-template issues that are also unavailable elsewhere

New to this Edition

This edition fully aligns with the new C++0x standard, and explains the implications for template usage associated with key C++ advances such as lambdas, inline namespaces, and user-defined literals.

Table of Contents


Acknowledgments for the Second Edition

Acknowledgments for the First Edition

About This Book


Part I: The Basics

Chapter 1: Function Templates

Chapter 2: Class Templates

Chapter 3: Nontype Template Parameters

Chapter 4: Variadic Templates

Chapter 5: Tricky Basics

Chapter 6: Move Semantics and enable_if<>

Chapter 7: By-Value or By-Reference?

Chapter 8: Compile-Time Programming

Chapter 9: Using Templates in Practice

Chapter 10: Basic Template Terminology

Chapter 11: Generic Libraries


Part II: Templates in Depth

Chapter 12: Fundamentals in Depth

Chapter 13: Names in Templates

Chapter 14: Instantiation

Chapter 15: Template Argument Deduction

Chapter 16: Specialization and Overloading

Chapter 17: Future Directions


Part III: Templates and Design

Chapter 18: The Polymorphic Power of Templates

Chapter 19: Implementing Traits

Chapter 20: Overloading on Type Properties

Chapter 21: Templates and Inheritance

Chapter 22: Bridging and Static and Dynamic Polymorphism

Chapter 23: Metaprograms

Chapter 24: Typelists

Chapter 25: Tuples

Chapter 26: Discriminated Unions

Chapter 27: Expression Templates

Chapter 28: Debugging Templates



Appendix A: The One-Definition Rule

Appendix B: Value Categories

Appendix C: Overload Resolution

Appendix D: Standard Type and Meta Utilities

Appendix E: Concepts






David Vandevoorde started programming C++ in the late 1980s. After obtaining a PhD from the Rensselaer Polytechnic Institute, he became technical lead of Hewlett-Packard’s C++ compiler team. In 1999 he joined the Edison Design Group (EDG), whose C++ compiler technology is widely recognized as the industry’s most advanced. He is an active member of the C++ Standard Committee and a moderator of the newsgroup comp.lang.c++.moderated (which he co-founded). He is the author of C++ Solutions, the companion to The C++ Programming Language, 3rd Edition.


Nicolai M. Josuttis is well known for his best-selling de-facto standard bookThe C++ Standard Library - A Tutorial and Reference. He is an independent technical consultant who designs object-oriented software for the telecommunications, traffic, finance, and manufacturing industries. He is an active member of the C++ Standard Committee and a partner at System Bauhaus, a German group of prominent object-oriented system development experts. Josuttis has written several other books on object-oriented programming and C++.


Doug Gregor is Senior Swift/C++/Objective-C Compiler Engineer at Apple. He holds a PhD in computer science from Rensselaer Polytechnic Institute, and did post-doctoral work at Indiana University.