tags:

views:

493

answers:

8

Can anyone recommend any good resources for learning C++ Templates?

Many thanks.

+7  A: 

I recomned that you get C++ Templates - The Complete Guide it's an excellent resource and reference.

Torbjörn Gyllebring
+3  A: 

This is a more advanced, but very useful, book on templates and template use.

Modern C++ Design

workmad3
To understand this book you'll need to understand how templates work first. It's an interesting book but not for the faint of heart, nor for beginners - which the OP is I think, if he needs to ask this question.
Roel
Only a beginner to Templates, not C++.
Dynite
As long as the basics are there, you can learn most of the important aspects about templates from their use in this book. Agreed that it is a huge learning curve to do it this way though :)
workmad3
Yeah beginner of templates I meant. For a beginner of C++ this book is definitely way out of league.
Roel
+2  A: 

Be sure to differentiate between generic programming and template metaprogramming (which is more like another paradigm)

Generic programming can be learnt from the C++ bible, but you can just as well take a look at the java generics etc...

one about metaprogramming: Josuttis' book C++ Templates: The Complete Guide

xtofl
+4  A: 

I've found cplusplus.com to be helpful on numerous occasions. Looks like they've got a pretty good intro to templates.

If its an actual book you're looking for, Effective C++ is a classic with a great section on templates.

Gordon Wilson
@Gordon Wilson: excellent 5 min reading there at cplusplus.com
Lazer
+2  A: 

Bruce Eckel's Thinking in C++ is how I learned about templates. The first volume has an introductory chapter and the second volume has an in-depth chapter on templates.

There's Bjarne Stroustrop's The C++ Programming Language which has a good chapter on them. And The C++ Standard Library: A Tutorial and Reference which is about the standard library, but would definitely help you get a better understanding of how templates could be used in the real world. .

Firas Assaad
Eckel's done me a few favors with his books - all for free!
slashmais
+1, Eckel books was brilliant for me
chester89
+2  A: 

The 2 volumes of 'Thinking in C++' go over the basics of templates. They can either be bought in print, or downloaded for free (and legal) use here.

workmad3
A: 

"The C++ Programming language" by Bjarne Stroustrop

TG
A: 

SGI Standard Template Library Programmer's Guide
http://www.sgi.com/tech/stl/

Tometzky