REVIEW - Effective STL - 50 Specific Ways to Improve Your Use of the Standard Template Library


Title:

Effective STL

50 Specific Ways to Improve Your Use of the Standard Template Library

Author:

Scott Meyers

ISBN:

Publisher:

Pearson Education (2001)

Pages:

260pp

Reviewer:

Alan Bellingham

Reviewed:

August 2001

Rating:

★★★★★


if you are using the STL on a day-to-day basis, and if you want to use it better, then I strongly recommend that you go out and get a copy of Effective STL now.

There are already several books dealing with that portion of the C++ Standard Library commonly known as the Standard Template Library. Some of these have been highly recommended in previous accu reviews, and rightly so. So the question must be, for whom is this book written, and why?

Let me first tell you what it isn't. It's not a tutorial - if you don't already know something about how to use the STL, then this is not the book to learn it from. It's not a reference trying to cover every corner of the STL - for that, I'd recommend the pairing of Nicolai Josuttis's" The C++ Standard Library " with Klaus Kreft& Angelika Langer's" Standard C++ IOStreams and Locales ", both reviewed elsewhere. Nor is it the advanced template code that Andrei Alexandrescu has shown us in" Modern C++ Design ". However, if you have been using the STL for a while, if you can see the way that the triad of containers, iterators and algorithms fit together, and if you are beginning to enjoy the expressive power available while knowing that there is still so much that you can learn, then this book is for you. Its ambition is explained in the subtitle:" 50 Specific Ways to Improve Your Use of the Standard Template Library ".

Like his previous books Effective C++ and More Effective C++ , it is organised as a set of short, concise articles that, although in cases mentioning other items, are each complete. They are organised into seven chapters: Containers; vector and string; Associative Containers; Iterators; Algorithms; Functors, Functor Classes, Functions, etc.; and Programming with the STL. Each chapter has a short introduction - half a page or so - and the rest consists of articles from a usual two to three pages up to a dozen or more when he explains something in more depth.

Even in the simplest articles, such as"Item 44: Prefer member functions to algorithms with the same names.", he is careful to explain why he gives the advice, and when not to take it. This isn't a set of rules to follow blindly: he would rather you understood why he says what he says, and for you to work out when not to follow, which is the difference between a true teacher and a mere instructor. Indeed, I found his attitude towards the C++ standard refreshing - it's one of respect while still pointing out the poorer decisions in the STL's design.

As for presentation, it's well laid out, and a nice touch is that he makes a sparing use of colour to indicate specific points in code. All too often, the general furniture of a code example obscures what you're supposed to be looking at. Here, that point will appear in red. This lends clarity without becoming garish, and I feel other books should follow this example.

There are a couple of typos - the introduction in Chapter 1 has an 'of' when 'or' would make sense. The author's surname is miss-spelt in the Library of Congress cataloguing data (copy editors rarely get to proof read the preliminary text in a book). But I didn't spot any slips in the code samples, and that initial pair of mistakes is not typical of the general quality of the text - it is telling that neither of those mistakes is in the actual body of one of the articles, which have been technically reviewed by the experts.

Also, there are subjects that don't really get covered - books on the STL tend to avoid the iostreams, for example - but perhaps that merely means that there is" More Effective STL " to come. I certainly hope so - this book has already made me go back and re-examine my STL use.

To conclude - if you are using the STL on a day-to-day basis, and if you want to use it better, then I strongly recommend that you go out and get a copy of Effective STL now. If you don't yet believe me, go tohttp://cseng.aw.com/book/backcover/0,3828,0201749629,00.htmland check some of the items for yourself.


Book cover image courtesy of Open Library.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.