Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Advanced metaprogramming in classic C++
Di Gennaro D., Apress, New York, NY, 2015. 572 pp. Type: Book (978-1-484210-11-6)
Date Reviewed: Aug 20 2015

C++ has proved a remarkable chameleon of a language. It started as a simple preprocessor that used C as a backend, became a real object-oriented language, added templates and the standard template library, and now increasingly uses template-based metaprogramming as a substantial part of the language, to the extent that we sometimes hear that C++ is not really an object-oriented language. These changes have not always been as much to the language itself so much as to the way people have used it.

This book covers metaprogramming at a reasonably advanced level. It has 12 chapters organized into three sections. “Prerequisites” covers the basics of template usage and provides some essential background for the rest of the book. “Techniques” covers using metaprogramming in some fairly typical programming usages, including compile time computational, interfaces, “algorithms” (beware, the word has a specific meaning here that is not quite what you might expect), code generators, and opaque types. “Applications” covers some other techniques and C++0X additions to the language.

Probably a good half of the text is code samples; some are reasonably short, but others span multiple pages, usually with an introduction and wrap up and some brief commentary along the way. Some of these samples are incomplete (often including only a line or two of the implementation), and at least one is said to not work at all. Oddly, for a book this focused on code, the code does not seem to be available online (though there’s an ad in the back offering a PDF and other e-text for just $5 more; they recommend copying and pasting the code samples from the e-text version by hand). Of course, if the bulk of the code were removed, this text would be much thinner.

The book is more of an annotated catalog of interesting templates and template methods than a text or instructional book, and opening it is kind of like opening a new catalog: if you’re interested in what’s offered, there’s much to look at and feel inspired by.

Despite the introductory section, this is not a book for most novices. Indeed, the book’s structure seems almost designed to discourage readers with less familiarity with C++. Further, the book lacks the kind of logical progression in the topics covered that would be helpful to a learner. Individual sections and topics are often presented with little motivation and only cursory explanations.

In some sections, the explanatory text is less than helpful. In more than one section, I could figure out what the code did, but the text left me confused. Seeking help in the index was almost invariably futile.

For the most part, the code does not include comments; this is a good thing since the surrounding text can present any commentary better and in a more reader-friendly way. The most common use of comments is to indicate elided text, but in some places there are comments on essential facets of the code that might be missed by someone primarily reading the text (which most of us do because code is best read in an editor).

Ideally, a reader should have a good familiarity with C++ and have at least some familiarity with template metaprogramming and some motivation for learning more. For such a reader, this will probably serve as an excellent source of good ideas, patterns to use, and code samples to use and extend.

More reviews about this item: Amazon

Reviewer:  Jeffrey Putnam Review #: CR143709 (1511-0931)
Bookmark and Share
  Featured Reviewer  
 
C++ (D.3.2 ... )
 
 
Object-Oriented Programming (D.1.5 )
 
 
Reference (A.2 )
 
Would you recommend this review?
yes
no
Other reviews under "C++": Date
A C++ toolkit
Shapiro J., Prentice-Hall, Inc., Upper Saddle River, NJ, 1991. Type: Book (9780131276635)
Dec 1 1991
Borland C++ handbook
Pappas C., William H. I., McGraw-Hill, Inc., New York, NY, 1991. Type: Book (9780078810152)
Feb 1 1993
Going from C to C++
Traister R., Academic Press Prof., Inc., San Diego, CA, 1993. Type: Book (9780126974126)
Apr 1 1994
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy