Buy new:
$59.99$59.99
FREE delivery:
Wednesday, March 15
Ships from: Amazon.com Sold by: Amazon.com
Buy used: $44.89
Other Sellers on Amazon
& FREE Shipping
88% positive over last 12 months
Usually ships within 3 to 4 days.
+ $5.53 shipping
92% positive over last 12 months
Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required. Learn more
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond 1st Edition
| Price | New from | Used from |
- Kindle
$34.99 Read with Our Free App - Paperback
$44.89 - $59.9912 Used from $18.38 7 New from $56.35
Enhance your purchase
Read the complete book reviewby Jack J. Woehr, Dr. Dobbs Journal, June 03, 2005
"If you're like me, you're excited by what people do with template metaprogramming (TMP) but are frustrated at the lack of clear guidance and powerful tools. Well, this is the book we've been waiting for. With help from the excellent Boost Metaprogramming Library, David and Aleksey take TMP from the laboratory to the workplace with readable prose and practical examples, showing that "compile-time STL" is as able as its runtime counterpart. Serving as a tutorial as well as a handbook for experts, this is the book on C++ template metaprogramming."
―Chuck Allison, Editor, The C++ Source
C++ Template Metaprogramming sheds light on the most powerful idioms of today's C++, at long last delivering practical metaprogramming tools and techniques into the hands of the everyday programmer.
A metaprogram is a program that generates or manipulates program code. Ever since generic programming was introduced to C++, programmers have discovered myriad "template tricks" for manipulating programs as they are compiled, effectively eliminating the barrier between program and metaprogram. While excitement among C++ experts about these capabilities has reached the community at large, their practical application remains out of reach for most programmers. This book explains what metaprogramming is and how it is best used. It provides the foundation you'll need to use the template metaprogramming effectively in your own work.
This book is aimed at any programmer who is comfortable with idioms of the Standard Template Library (STL). C++ power-users will gain a new insight into their existing work and a new fluency in the domain of metaprogramming. Intermediate-level programmers who have learned a few advanced template techniques will see where these tricks fit in the big picture and will gain the conceptual foundation to use them with discipline. Programmers who have caught the scent of metaprogramming, but for whom it is still mysterious, will finally gain a clear understanding of how, when, and why it works. All readers will leave with a new tool of unprecedented power at their disposal―the Boost Metaprogramming Library.
The companion CD-ROM contains all Boost C++ libraries, including the Boost Metaprogramming Library and its reference documentation, along with all of the book's sample code and extensive supplementary material.
- ISBN-100321227255
- ISBN-13978-0321227256
- Edition1st
- PublisherAddison-Wesley Professional
- Publication dateDecember 10, 2004
- LanguageEnglish
- Dimensions7.3 x 0.9 x 9.1 inches
- Print length408 pages
Frequently bought together

- +
- +
What other items do customers buy after viewing this item?
Editorial Reviews
From the Back Cover
"If you're like me, you're excited by what people do with template metaprogramming (TMP) but are frustrated at the lack of clear guidance and powerful tools. Well, this is the book we've been waiting for. With help from the excellent Boost Metaprogramming Library, David and Aleksey take TMP from the laboratory to the workplace with readable prose and practical examples, showing that "compile-time STL" is as able as its runtime counterpart. Serving as a tutorial as well as a handbook for experts, this is the book on C++ template metaprogramming."
―Chuck Allison, Editor, The C++ Source
C++ Template Metaprogramming sheds light on the most powerful idioms of today's C++, at long last delivering practical metaprogramming tools and techniques into the hands of the everyday programmer.
A metaprogram is a program that generates or manipulates program code. Ever since generic programming was introduced to C++, programmers have discovered myriad "template tricks" for manipulating programs as they are compiled, effectively eliminating the barrier between program and metaprogram. While excitement among C++ experts about these capabilities has reached the community at large, their practical application remains out of reach for most programmers. This book explains what metaprogramming is and how it is best used. It provides the foundation you'll need to use the template metaprogramming effectively in your own work.
This book is aimed at any programmer who is comfortable with idioms of the Standard Template Library (STL). C++ power-users will gain a new insight into their existing work and a new fluency in the domain of metaprogramming. Intermediate-level programmers who have learned a few advanced template techniques will see where these tricks fit in the big picture and will gain the conceptual foundation to use them with discipline. Programmers who have caught the scent of metaprogramming, but for whom it is still mysterious, will finally gain a clear understanding of how, when, and why it works. All readers will leave with a new tool of unprecedented power at their disposal―the Boost Metaprogramming Library.
The companion CD-ROM contains all Boost C++ libraries, including the Boost Metaprogramming Library and its reference documentation, along with all of the book's sample code and extensive supplementary material.
About the Author
David Abrahams is a founding member and moderator of the Boost C++ library development group. Dave has been an ANSI/ISO C++ committee member since 1996, where he is best known for contributing a theory, specification, and implementation of exception handling for the C++ standard library. His company, Boost Consulting, provides Boost-related support and development services and professional training in the art of software construction.
Aleksey Gurtovoy is a technical lead for MetaCommunications and a contributing member of the Boost C++ community. Aleksey is the original author of the Boost Metaprogramming Library. He has been working with C++ since 1993, and holds a M.S. degree in computer science from Krasnoyarsk Technical State University, Russia.
Product details
- Publisher : Addison-Wesley Professional; 1st edition (December 10, 2004)
- Language : English
- Paperback : 408 pages
- ISBN-10 : 0321227255
- ISBN-13 : 978-0321227256
- Item Weight : 1.55 pounds
- Dimensions : 7.3 x 0.9 x 9.1 inches
- Best Sellers Rank: #884,888 in Books (See Top 100 in Books)
- #251 in C++ Programming Language
- #620 in Computer Programming Languages
- #3,045 in Computer Software (Books)
- Customer Reviews:
About the author

Discover more of the author’s books, see similar authors, read author blogs and more
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on Amazon-
Top reviews
Top reviews from the United States
There was a problem filtering reviews right now. Please try again later.
The authors base most of their discussion on the open-source Boost Meta-programming library (MPL), perhaps the most widely known and highly developed usage of this capability. Most of the discussion patiently describes this exotic set of capabilities, giving the reader a clear idea of what the library does and some idea of how the library does it. I came away a bit uncertain about the authors' purpose, though. I didn't see enough detail in describing the primitive C++ mechanisms for a reader to go off and use those primitives in new ways - this largely discusses the MPL library elements as black boxes, without a lot of detail about how they work. But, if the intended reader was meant to incorporate an existing library (like MPL) into an application, I didn't see enough in the way of practical examples or motivation. It's nice that API elements exist for handling lists like - but why? In what context do such lists arise? What useful work does this tool perform? Or is it just an idea book for an obfuscated C contestant?
Unless you've mastered the user-unfriendly documentation for Boost MPL or other libraries mentioned here, this really is the only book on the topic. I wish it covered everyday basics a bit better, for example checking that some class in a template parameter is derived from some other class. I look forward to the next reference on the topic, one that goes over internals of the library more thoroughly, or one that gives more examples of practical applications.
-- wiredweird
Four stars - but that might have been different if there were another book on the topic to compare it to.
this has been so painful.
First, this is a really great book if you're interested in meta-programming.
It's dubious whether meta-programming does a better job than code generation,
but if you're interested in learning it, this is the book. It's well-written,
the explanations are clear, the examples are relevant, and the author certainly
is an authority as a major contributor to the Boost library. Kudos.
However, I bought the Kindle edition of this book. While I've enjoyed many other
books in Kindle format in the past (mainly stories), the transfer job from paper
to e-book on this specific book is nothing short of terrible. The code is
formatted so large that the lines overflow from one line to the next, making the
code difficult to read (adding to the already difficult nature of MPL code that
is in itself not for the faint of heart), and the page breaks appear to have
been done carelessly, so I end up having to go back and forth between pages all
the time in order to read the explanations that correspond to the code blocks.
It's impossible to enjoy reading this book on my Kindle. (And this is not the
case with some other e-books about computer topics that I've read on the
device: it's possible to do a good job at the conversion.)
Whoever has done the conversion work to e-book has ruined it. Dave Abrahams'
work deserves better. Don't buy this book in Kindle format, it's a real waste of
your money. If you do buy the book, buy the paper edition instead.
Secondly the book explains Meta-programming. This is a new concept to a lot of C++ programmers and old hat to LISP programmers. The C++ pre-compiler is constrained to integral types as constraints. But there are a host of tricks you can use within that constraint to build libraries that adapt to their calling structure. Thus generating code that is as efficient as hand written. Of course with your compiler, your milage may vary.
The other great thing about using this library, MPL, is that where you would write repeticious template code for every parameter in a template'd library like Tuples, you can automate with it with MPL.
Meta programming is a pretty new concept within the C++ community and this book will give us a common language to talk about it. There are other resources on the net, but this book pulls them together.
Highly recommended for expert C++ programmers, C++ Library writers and intermediate programmers study'ing to become experts. If you finished Andrei's book, "Modern C++ Design", this is a great next book to buy and own.
I still recommend this book, even with its shortcomings. Modern C++ uses templates extensively, and the content in this book is still relevant.
Top reviews from other countries
Overall I rated it 4 stars as although I'm not very fond of the book as it reads more like a reference at times, I do I feel that it is one of the most advanced books out there and the author is clearly competent on the subject
Développant essentiellement en C# depuis quelques années par commodité, j'ai (re)découvert avec surprise que la nouvelle mouture du C++ n'a plus rien à envier au C#. Pour préserver la compatibilité, les concepteurs ont préféré des évolutions basées sur les templates plutôt que de toucher au coeur du language. Ce livre permet d'en comprendre le fonctionnement en détail.
Attention, il ne s'adresse pas aux débutants mais aux initiés possédant déjà une solide expérience du C++ et ayant déjà des notions sur les templates.
Le livre est écrit par les fondateurs de la STL et des librairies Boost. Ils y expliquent leurs choix techniques de façon claire et pédagogique. Ce livre m'a permis de comprendre le pourquoi du comment de l'implémentation de containers STL que j'utilise depuis des années sans jamais m'être posé de questions. Pour les passionnés de C++, ce livre se lit comme un roman (j'ai bien dit "les passionnés" ;-).
Ce livre devrait être lu par toute personne touchant de près ou de loin à la programmation.
Certes il n'est pas bon pour une première approche des templates en C++, mais une fois lancé, rien ne semble impossible.
Non seulement vous saurez comment tirer le meilleur des templates, mais en plus vous saurez comment fonctionne toutes les bibliothèques basées sur cette technique, notamment BOOST.
Vous apprendrez entre autre à optimiser l'usage des templates, à nettoyer la trace de debug ou à construire un analyseur syntaxique extensible à la compilation.








