Templates are among the most powerful features of C++, but they are too often neglected, misunderstood, and misused. C++ The Complete Guide provides software architects and engineers with a clear understanding of why, when, and how to use templates to build and maintain cleaner, faster, and smarter software more efficiently. C++ Templates begins with an insightful tutorial on basic concepts and language features. The remainder of the book serves as a comprehensive reference, focusing first on language details, then on a wide range of coding techniques, and finally on advanced applications for templates. Examples used throughout the book illustrate abstract concepts and demonstrate best practices. Readers learn This practical guide shows programmers how to exploit the full power of the template features in C++. The companion Web site at contains sample code and additional updates.
Super dry, but great to take your C++ programming skills to the next level. I’ve always been boggled looking at implementations of stuff in the standard library and certain pieces of OpenFOAM code, and this book cleared up my confusion and gently introduced the patterns commonly used for template programming. Now I know what’s going on seeing stuff like enable_if, typename=void, etc. Worth the read, overall!
Decent way to learn C++ templates if you must do so. Prepare to alternately have your mind blown and weep at the hoops C++ makes you jump through to do such conceptually simple things.
If it's the concepts you're after rather than specifically C++, I would highly recommend using another language. If it's parametric polymorphism you want, try OCaml or Standard ML (or use a dynamically typed language where this is unnecessary). If it's metaprogramming you're after, look at any Lisp dialect or MetaOCaml.
I'm halfway through this book. I'm not in love with the way its written -- it's dense and poorly organized. The information doesn't seem to be delivered in the linear fashion I want for a book thats meant to be read through and not just referenced. The preface even goes so far as to say "Read section 1, then section 3, then look back at section 2 and then read section 4 if you want".
However --- The information itself is gold. This book really unlocks the mystery of how, when and why to use a template instead of traditional inheritance/virtual function. For that I am indebted to it.
Published in 2002, this is a thorough coverage of everything to do with C++ templates, as it was with the C++ standard at the time. I wish I had read it years ago. It covers how templates work at various levels of complexities and how to use them. However, the C++11 specification is now standard, and a lot has since changed. I'm very pleased to read that the authors are planning a revised edition.