29

I am learning templates. Which book is worth buying for doing template programming?

I already have The C++ Programming Language and Effective C++.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
yesraaj
  • 46,370
  • 69
  • 194
  • 251
  • 1
    Duplicate of [The Definitive C++ Book Guide and List](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) (there is no need for more than one C++ book list) – James McNellis Jul 15 '10 at 13:45

8 Answers8

44

Those two books are pretty good in my opinion and they helped me a lot

             

The first one explains how templates work. The second book is more about how to use them. I recommend you to read the first book before starting with Modern C++ Design because that's heavy stuff.

Matthieu
  • 4,605
  • 4
  • 40
  • 60
Konrd
  • 682
  • 5
  • 10
  • 1
    Modern C++ Design is absolutely brilliant. Not only will you pick up wonderful programming tips, you'll also learn how to keep your code simple. – Joe Oct 24 '11 at 17:16
10

Maybe a bit mind-boggling if you are just learning, but after the books you mention, you may want to read Andrei Alexandrescu's Modern C++ Design, if only to learn what can be accomplished through templates. Besides, it discusses many advanced aspects of templates wonderfully.

Ferruccio
  • 98,941
  • 38
  • 226
  • 299
Gorpik
  • 10,940
  • 4
  • 36
  • 56
8

Search for fairly recent book "Advanced C++ Metaprogramming" by Davide Di Gennaro

Matthieu
  • 4,605
  • 4
  • 40
  • 60
mloskot
  • 37,086
  • 11
  • 109
  • 136
5

Both Modern C++ design and C++ Template Metaprogramming are very good (and quite advanced) books on the subject. I have a strong personal preference for the first.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Paolo Tedesco
  • 55,237
  • 33
  • 144
  • 193
2

C++ Templates: The Complete Guide is your best bet. You could also learn about the Standard Library which heavily uses templates.

Community
  • 1
  • 1
Firas Assaad
  • 25,006
  • 16
  • 61
  • 78
1

"C++ Templates: The Complete Guide (Vandevoorde & Josuttis)" is excellent for the theory. Then you can learn even more about actual templating practice by looking at how templates are used in the Boost library.

Matthieu
  • 4,605
  • 4
  • 40
  • 60
timday
  • 24,582
  • 12
  • 83
  • 135
1

There is a hidden treasure in C++ templates that very few people are aware of: C++ Common Knowledge: Essential Intermediate Programming.

The last 15 chapters of that book both teaches better and complements C++ Template Metaprogramming in some respects. I strongly recommend anyone who is to learn templates to read this book foremost.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Özgür
  • 8,077
  • 2
  • 68
  • 66
0

Effective STL by Scott Meyers

INS
  • 10,594
  • 7
  • 58
  • 89