C++ Template Metaprogramming and over 2 million other books are available for Amazon Kindle . Learn more
  • RRP: £33.99
  • You Save: £11.00 (32%)
FREE Delivery in the UK.
Only 2 left in stock (more on the way).
Dispatched from and sold by Amazon.
Gift-wrap available.
C++ Template Metaprogramm... has been added to your Basket
Trade in your item
Get a £10.19
Gift Card.
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See all 2 images

C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond (C++ in Depth) Paperback – 10 Dec 2004

See all 3 formats and editions Hide other formats and editions
Amazon Price New from Used from
Kindle Edition
"Please retry"
"Please retry"
£18.89 £19.04
£22.99 FREE Delivery in the UK. Only 2 left in stock (more on the way). Dispatched from and sold by Amazon. Gift-wrap available.

Frequently Bought Together

C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond (C++ in Depth) + Modern C++ Design: Generic Programming and Design Patterns Applied: Applied Generic and Design Patterns (C++ in Depth) + Exceptional C++
Price For All Three: £78.82

Buy the selected items together

Trade In this Item for up to £10.19
Trade in C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond (C++ in Depth) for an Amazon Gift Card of up to £10.19, which you can then spend on millions of items across the site. Trade-in values may vary (terms apply). Learn more

Product details

  • Paperback: 400 pages
  • Publisher: Addison Wesley; 1 edition (10 Dec. 2004)
  • Language: English
  • ISBN-10: 0321227255
  • ISBN-13: 978-0321227256
  • Product Dimensions: 18.9 x 2 x 23.5 cm
  • Average Customer Review: 4.2 out of 5 stars  See all reviews (4 customer reviews)
  • Amazon Bestsellers Rank: 422,557 in Books (See Top 100 in Books)
  • See Complete Table of Contents

More About the Author

Discover books, learn about writers, and more.

Product Description

From the Back Cover

Abrahams and Gurtovoy have written something close to a classic… marvelous fun to read…
Read the complete book review by 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.


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.

Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index
Search inside this book:

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

4.2 out of 5 stars
5 star
4 star
3 star
2 star
1 star
See all 4 customer reviews
Share your thoughts with other customers

Most Helpful Customer Reviews

7 of 8 people found the following review helpful By J. Jack on 28 Dec. 2007
Format: Paperback
Not for the faint of heart. The book spends no time introducing simple template concepts - it skips straight into the application of them, using boost's MPL library past chapter 1.

Having reached chapter 3 in 3 days, I can faithfully say I've learnt more about how to use templates than I have in the last 3 years. Never before have I understood the workings (and reasoning behind) the STL's prominent use of *_traits<> structures, such as char_traits<>. And for that fact alone, this book is worth the price.

The rest of the book delves deeper still, and I suspect these more advanced topics are still just as eye-opening.

If you don't own anything on C++ metaprogramming, this is the book.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
4 of 6 people found the following review helpful By Todor Todorov on 21 Mar. 2005
Format: Paperback
This is The Book on C++ template meta programming. It seems in future more and more C++ programmers should make them selfs familiar with languages like Haskel or Ocaml or in general, with functional programming. But The Book is really great achievement.
It opens my mind especially the chapters for DSEL. It very consistently presents all of the meta programming machinery with really industry strength examples from the Boost. Thank you guys for writing it and congratulations.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
0 of 2 people found the following review helpful By Metodi Todorov on 23 May 2011
Format: Paperback
This book is one of a kind. In the inet there is a lot of information about metaprogramming, but in the book all information is well formed and easy to read.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
2 of 9 people found the following review helpful By Matthew Shaer on 20 Feb. 2009
Format: Paperback
The first half of the book feels like a reference manual on MPL. Some of the rest of the book was interesting, but overall it did not live up to my expectations at all.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again

Most Helpful Customer Reviews on Amazon.com (beta)

Amazon.com: 16 reviews
29 of 31 people found the following review helpful
An interesting book... 30 Dec. 2004
By HarryCat - Published on Amazon.com
Format: Paperback
This is a really interesting book. The template metaprogramming technical topics covered are extremely advanced, and right at the leading edge of C++ library development, yet the step-by-step presentation makes the material understandable even to intermediate programmers. Since the book draws its examples from code that works with the Boost libraries (supplied on a CD), readers can try the examples and play around with them to see how they work.

Some of the libraries discussed (Boost Type Traits, Boost Bind) are well along to becoming part of the C++ standard via a library technical report, so they will eventually become available to every C++ programmer. The bulk of the book is devoted to the Boost Metaprogramming Library, which packages up a lot of advanced techniques into accessible form.

One issue with template metaprogramming is that compile times can get out of hand. The book includes an appendix with hints on avoiding the problem, together with test timings for a half-dozen popular compilers. I really like the timings; too many other authors make assertions about efficiency without supporting data.

I would guess that this book will be of interest to intermediate and advanced C++ programmers interested in library development. And less interesting to beginning programmers, or programmers who never package up their creations into libraries.
44 of 51 people found the following review helpful
I found the title misleading 25 April 2006
By Andrew J. Lusk - Published on Amazon.com
Format: Paperback
This book is called "C++ Template Metaprogramming" but it should be called "Boost MPL API Reference." The first portion of this book covers the basics of template metaprogramming fairly well, but what I wanted the rest of the book to cover were both advanced techniques and real-world applications. What I got was material on how to use the Boost metaprogramming library. This book mostly covers just that library, and the various templates that it offers, but what I felt the book should have provided was not only how the more interesting parts of the MPL were implemented, but also interesting applications of the MPL where some interesting algorithm was made possible by template metaprogramming. I can look up the MPL reference docs online, thank you very much.

To summarize - this is a pretty good introduction to template metaprogramming, but seems to be suited for the unlikely position of someone who wants or needs to use this technique, but isn't academically interested in it, and so mainly needs a walkthrough of the set of standard functions available as part of the MPL.

This book is a bad choice for those interested in template metapgramming and wondering if it might help them, but want to learn more about it and its applications first.
19 of 21 people found the following review helpful
Necessary book for template library writers. 20 Jan. 2005
By G. Powell - Published on Amazon.com
Format: Paperback Verified Purchase
This book describes the boost MPL library. Its a very useful guide to this library and it includes enough examples to walk you through how to use it.

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.
7 of 8 people found the following review helpful
In depth, but not intuitive 20 May 2008
By Mr Squiggle - Published on Amazon.com
Format: Paperback
I knew in purchasing this book that most of the time it would just be talking about the Boost MPL. That shouldn't be too bad - the Boost MPL is pretty much the fore-running meta-programming library, and there has to be lots of concepts in there to be learnt too, other than library specifics, right?
This book completely lives up to this explanation. Very quickly we are into the guts of the library, even within the beginner's tutorial section. There certainly is a LOT of concepts to be learnt and used, even if externally to the MPL.
However, I found that very quickly I was having to reread and triple-read passages to try and distil a principle from the library construct being explained. They principles are there, and are good, but I find that they are not presented distinctly enough from the library itself. This results in what feels like a lot of work to really understand the book (other than just know how to use the library).
I don't consider myself slow - I got through almost all of "Modern C++ Design" (by Alexandrescu) without having to go to a computer, but here I really felt like I NEEDED to try this stuff out on a computer and attempt the problems at the end of the chapter. This book is a lot of work - beware! - and particularly it is more than I feel should be necessary, if perhaps the authors allowed themselves more time to explain principles and concepts away from the interface of their library.
However, there is a lot of knowledge here that I don't think that you can find elsewhere, and it is a topic that is, by nature, a bit mind-bending, so I am still definitely happy with the purchase.
7 of 8 people found the following review helpful
An excellent treatment of the topic 19 Oct. 2010
By John Wiegley - Published on Amazon.com
Format: Paperback
This was a pivotal book for me. I'd been working with C++, both as a programmer and a compiler writer, for almost 20 years. Yet despite an intimate familiarity with templates, the notions of template metaprogramming had always eluded me. By chapter 3 of this book, however, it felt as though a heavy curtain had been lifted. I actually became excited to wake up each day at the thought of reading the next chapter! Imagine that, from a C++ book.

The material is well-paced, lucidly written, and doesn't stray into minutae any longer than necessary. I would recommend it to anyone who wants to find out more about applying metaprogramming techniques to their own code. I'm already thinking of news ways I can use it. The only caveat I would mention is that your background will in large part determine this book's value to you. Coming from a C++ background, and lately having an intense interest in Haskell, I found many of this book's points "popped out" at me, showing connections between runtime C++ and compile-time functional programming (in the strange meta-language that is compile-time C++). But had I not had that prior experience, and been struggling with the very issues this book solves, some of it may not have had as great an impact. Be ready to do more research if you find the material a bit rough going. There are some profound implications between its pages that may not be obvious at first, but they're there.
Were these reviews helpful? Let us know