» » Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library

Download Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library fb2

by Scott Meyers
Download Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library fb2
Programming
  • Author:
    Scott Meyers
  • ISBN:
    0201749629
  • ISBN13:
    978-0201749625
  • Genre:
  • Publisher:
    Addison-Wesley Professional; 1 edition (June 16, 2001)
  • Pages:
    288 pages
  • Subcategory:
    Programming
  • Language:
  • FB2 format
    1978 kb
  • ePUB format
    1897 kb
  • DJVU format
    1491 kb
  • Rating:
    4.9
  • Votes:
    423
  • Formats:
    mobi docx txt lit


C++’s Standard Template Library is revolutionary, but learning to use it well has always been a challenge

C++’s Standard Template Library is revolutionary, but learning to use it well has always been a challenge. Until now. In this book, best-selling author Scott Meyers (Effective C++, and More Effective C++) reveals the critical rules of thumb employed by the experts – the things they almost always do or almost always avoid doing – to get the most out of the library

Several standard non-STL containers, including arrays, bitset, valarray, stack, queue, and priority queue. One of the easiest ways to do this is through the liberal use of typedefs for container and iterator types. Hence, instead of writing this }; vector

Several standard non-STL containers, including arrays, bitset, valarray, stack, queue, and priority queue. Because these are non-STL containers. I have little to say about them in this book, though Item 16 mentions a case where arrays are preferable to STL containers and Item 18 explains why bitset may be better than vector. Hence, instead of writing this }; vector

C++ Programming with the Standard Template Library John K. Ousterhout, Tcl and the Tk Toolkit Craig Partridge .

This e-book reproduces in electronic form the printed book content of Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library, by Scott Meyers.

book by Scott Meyers. Effective Modern C++: 42 Specific Ways to Improve Your Use of C++11 and C++14. Following in the tradition of his prior books, Meyers delivers another gem with Effective STL. This one is a must have for your software development bookshelf. I user several STL books regularly and none of them have come close to giving me the in depth understanding that this book has.

Providing information on C++'s Standard Template Library, this book shows you how to use it. It includes: advice on choosing among standard STL containers, nonstandard STL containers, and non-STL containers. It includes: advice on choosing among standard STL containers, nonstandard STL containers, and non-STL containers; techniques to maximize the efficiency of the STL and the programs that use it; insights into the behavior of iterators; and more. Scott Meyers is one of the world's foremost authorities on C++, providing training and consulting services to clients worldwide. He is the author of the best-selling Effective C++ series of books (Effective C++, More Effective C++, and Effective STL) and of the innovative Effective C++ CD.

Effective STL shows you how to use it. Each of the book’s 50 guidelines is backed by Meyers’ legendary analysis and . Each of the book’s 50 guidelines is backed by Meyers’ legendary analysis and incisive examples, so you’ll learn not only what to do, but also when to do it – and why. Highlights of Effective STL include: Advice on choosing among standard STL containers (like vector and list), nonstandard STL containers (like hash set and hash map), and non-STL containers (like bitset).

Description of a Book. C++’s Standard Template Library is revolutionary, but learning to use it well has always been a challenge. In this book, best-selling author Scott Meyers ( Effective C++, and More Effective C++ ) reveals the critical rules of thumb employed by the experts – the things they almost always do or almost always avoid doing – to get the most out of the library

Pearson Education) Explains STL, Standard Template Library, and how to use it. Offers STL programmes at varying levels of skill . Effective STL 50 Specific Ways to Improve Your Use of the Standard Template Library.

Pearson Education) Explains STL, Standard Template Library, and how to use it. Offers STL programmes at varying levels of skill techniques to master the efficiency of STL and STL programs, with insights into functions, allocators, and iterators, among other concepts. TT. ADDISON-WESLEY Boston, San Francisco, New York, Toronto, Montreal London, Munich, Paris, Madrid Capetown, Sydney, Tokyo, Singapore, Mexico City.

Effective STL. 50 specific ways to improve your use of the Standard Template . The book consists of 7 chapters. STL provides four types of components: containers, algorithms, iterators, and functors. 50 specific ways to improve your use of the Standard Template Library. I’ll go ahead and say that it’s more than a library: it’s a whole world with its philosophy and rules, a world full of opportunities. As a rule of thumb, the stronger the tool, the harder it is to master. The first three chapters cover the containers in STL.

Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library. Overview of The New C++ (C++11). Annotated training materials published by Artima Press.

“This is Effective C++ volume three – it’s really that good.”– Herb Sutter, independent consultant and secretary of the ISO/ANSI C++ standards committee “There are very few books which all C++ programmers must have. Add Effective STL to that list.”– Thomas Becker, Senior Software Engineer, Zephyr Associates, Inc., and columnist, C/C++ Users Journal

C++’s Standard Template Library is revolutionary, but learning to use it well has always been a challenge. Until now. In this book, best-selling author Scott Meyers ( Effective C++ , and More Effective C++ ) reveals the critical rules of thumb employed by the experts – the things they almost always do or almost always avoid doing – to get the most out of the library.

Other books describe what’s in the STL. Effective STL shows you how to use it. Each of the book’s 50 guidelines is backed by Meyers’ legendary analysis and incisive examples, so you’ll learn not only what to do, but also when to do it – and why.

Highlights of Effective STL include:

Advice on choosing among standard STL containers (like vector and list), nonstandard STL containers (like hash_set and hash_map), and non-STL containers (like bitset). Techniques to maximize the efficiency of the STL and the programs that use it. Insights into the behavior of iterators, function objects, and allocators, including things you should not do. Guidance for the proper use of algorithms and member functions whose names are the same (e.g., find), but whose actions differ in subtle (but important) ways. Discussions of potential portability problems, including straightforward ways to avoid them.

Like Meyers’ previous books, Effective STL is filled with proven wisdom that comes only from experience. Its clear, concise, penetrating style makes it an essential resource for every STL programmer.


Windbearer
"Effective STL" is the final installment of Scott Meyers' "Effective" trilogy. While the first two volumes ("Effective C++" and "More Effective C++") discussed general tips on C++, "Effective STL" focuses exclusively on the STL, which is taken to mean the parts of the C++ standard library that work with iterators. It goes without saying that this book should be read after "Effective C++, Third Edition". One could probably get away with skipping over "More Effective C++", thus going directly from "Effective C++" to "Effective STL".

The Good: in typical Meyers style, the writing is generally relaxed and even pleasant, e.g. "This works, but only if you're not terribly picky about what you mean by 'works'." (Item 7). Like in "Effective C++" (but in contradistinction to "More Effective C++") most Items are quite short and therefore easily digestible. Similarly, in this volume, too, Meyers often reiterates the main point of each Item before concluding: this sometimes feels needlessly repetitive, but is mostly great for driving home the essential issues. As in the earlier volumes, things are for the most part organized intuitively. Meyers has a knack for pedagogy and thus for different ways of getting the message across, cf. the few tables that are included in the book, most notably the one on search options in Item 45. The author's organizational prowess is also evidenced by the numerous cross-references and the list of performance-related Items at the end of the Introduction. Moving on to the specifics of the material covered in this volume: Meyers is at his best when addressing a host of topics that elsewhere are often jumbled together. The finest examples of this skill are Items 31, 41, and 45, which deal with sorting options, function adapters, and search algorithms, respectively. Meyers manages to methodically explain the commonalities and distinctions between related concepts. The overwhelming majority of the topics covered in this volume have to do with real-life programming in C++, e.g. how to pass vector and string data to legacy APIs (Item 16). In this vein, some of the Items in "Effective STL" can safely be said to constitute required reading, especially the following on: a) range member functions versus their single-element counterparts (Item 5), b) C++'s most vexing parse (Item 6), c) the swap trick used to eliminate excess capacity (Item 17), d) the erase-remove idiom that allows one to really remove elements from a container (Item 32), e) the superiority of algorithm calls in comparison with hand-written loops (Item 43), and f) the advantages of container member functions over STL algorithms with the same name (Item 44). Other Items feel like digressions (e.g. Item 10 on allocators, Item 18 on vector of bools, or Item 23 on replacing associative containers with sorted vectors) though that doesn't make them any less interesting.

The Bad: this volume is not introductory but it isn't a very good reference either. For example, in the early Items Meyers talks about list's splice member functions matter-of-factly. Of course, "Effective C++" and "More Effective C++" are also not introductory or reference works, but there's a major difference: in those books when Meyers discusses a new construct he first explains it briefly. In "Effective STL", on the other hand, he often implicitly assumes the reader will go look stuff up in something like Josuttis' book "The C++ Standard Library" (regarding which Meyers writes: "[e]very C++ programmer should have ready access to a copy"). Obviously, a short hints-and-tips type book cannot contain everything, but the reader's life would have been made much easier had Meyers simply included a few reference tables (containing function signatures) in an Appendix. Moreover, what the Appendices do include is not uniformly interesting: Appendix B addresses developers using Microsoft Visual C++ versions 4-6 and is therefore largely irrelevant today. Another point where "Effective STL" diverges slightly from the earlier volumes' practices is cross-referencing. Meyers mentions other Items extensively in those books, too, but here he's gone overboard: for example, by the time he introduces unary_function and binary_function in Item 40, he has referred to them 10 times already, which probably means that they should have been covered (way) earlier. On a different note, given the non-exhaustive nature of the book, there's important stuff that's missing, e.g. there's absolutely no mention of the at() member function of vectors, deques, and strings. Also, a few of the examples feel somewhat contrived (e.g. anyone paying attention up to that point can tell that the initially proposed solution in Item 42 is obviously unnecessary), though this is more the exception than the rule. Finally, the book's age is starting to show: "Effective STL" was published in 2001 so (despite being more up to date than "More Effective C++") a number of things would be done differently today. For example, Meyers uses for_each in many code snippets, most of which would look much cleaner using lambdas.

In a nutshell, I would say that this book is not as indispensable as "Effective C++, Third Edition", but is probably more useful than "More Effective C++". Meyers is a talented author and instructor, so all three volumes are worth reading. Were "Effective STL" to be re-written today (using C++11 and its library) the result would certainly be more interesting, but the advice contained in this book is solid, nonetheless. Overall, four and a half stars.

Alex Gezerlis
Ausstan
I was brought up on STL with C++, and can't imagine the language without it. This book, however, opened my eyes to many of the strengths, weaknesses, and issues of the Standard Template Library. It tells the reader why to use a deque of booleans instead of vector<bool>. More importantly, it provides warnings about features to avoid, as well as how to make better use of this now standard library. Open source software contributors should also check this book out to understand best practices. There's a temptation in C++ to treat iterators like pointers, but Scott Meyers explains clearly why you shouldn't. He briefly discusses the 100 algorithms that are offered in STL, and several key Items, like "Item 30: Make sure destination ranges are big enough" and "Item 32: Follow remove-like algorithms by erase if you really want to remove something."

Readers even get some of the back story on the decisions that went into the development of STL and why they made some of the compromises that they did. The book is so clear, so lucid, and so interesting that even the novice C++ programmer will enjoy its prose. It is thoroughly informative even for programmers at all levels of experience with C++.
Frosha
I'm a professional software engineer. I write code all day long and have lots of experience with C++, but I hadn't used STL much until recently. If you're in a similar situation--decent C++ knowledge but not an STL expert--this book is for you. I haven't even read the whole thing yet, and already I am using patterns from the book to write more effective code.

Before I started this book, I thought STL was kind of neat. It had some useful containers. It was nice to be able to use a list or map or string class that had already been tested.

Boy, was I underestimating the power of STL. This book has made me a big STL fan, but I'm not reviewing the STL now so I'll leave that topic alone... Thanks to Scott Meyers, I have a much better grasp of the capabilities and limitations of STL. I can use it to do a lot more. I write more concise code that's easier to read and debug. I make better choices about which containers to use. I recognize situations where I can use an STL algorithm instead of many lines of my own code.

In short, I look at the STL code I wrote before and laugh... I mean, it all works, but the Meyers book has taken my use of (and appreciation for) the STL to a whole new level. I recommend this book for any C++ developer who isn't already an STL expert.

An update, 2 years after the above text was written: I still recommend this book to people and still think it's the best STL book I've read.
Humin
I am a generally experienced C++ programmer, but I haven't dealt with STL very much. I plan to use it a lot more in the near future, and this sounded to me like a book that would be useful to avoid a lot of pitfalls and establish good habits right off the bat. Man, was this book a smart buy! I would give it 6 stars if I could.

It doesn't take one very long to realize that this book is chock full of insight and wisdom. Every item he presents is a gem. In addition, Mr. Meyers' writing style is more conversational than techie. Don't misunderstand. He really gets into the nitty-gritty of compiler internals and such, but he does it in a way that makes it much more easy to read than material written by holier-than-thou, academia types.

This was the first time I read anything by Mr. Meyers, but based on the quality of this book I plan on buying his "Effective C++" books in the near future.