Effective STL: 50 Specific Ways to Improve the Use of the Standard Template Library (Addison-Wesley Professional Computing Series)Scott Meyers
Taschenbuch
Written for the intermediate or advanced C++ programmer, renowned C++ expert Scott Meyers provides essential techniques for getting more out of the Standard Template Library in < I> Effective S T L, a tutorial for doing more with this powerful library. S T L is a hugely powerful feature of today's C++, but one with a well-earned reputation for complexity. The book is organized into 50 tips that explore different areas of the S T L. Besides providing a list of dos and don'ts, Meyers presents a lot of background on what works and what doesn't with S T L. Each tip is demonstrated with in-depth coding samples, many of which make use of two-color printing to highlight the most important lines of code. ( Advanced developers will enjoy Meyers's in-depth explanations, while those who are in a hurry can skip ahead to the recommended tip itself. ) A good part of this book involves using containers, like vectors and maps, which are built into S T L. ( Besides the standard built-in containers, the author also highlights recent additions to S T L like < I> B-trees, which are available as extensions from other vendors. ) You'll learn the best ways to allocate, add, change, and delete items inside containers, including associative containers like maps. You'll also learn to avoid common pitfalls, which can result in writing code that is slow or just plain wrong. Other areas covered in < I> Effective S T L cover getting the most out of the 100-plus S T L algorithms that are bundled with this library. Meyers shows you how to choose the correct algorithm for sorting and other functions. ( Even advanced developers will learn something here. ) Sections on using function objects (called < I>functors) round out the text. Meyers shows you when these classes make sense and the best ways to implement them. Besides specific tips, you'll get plenty of general programming advice. A useful appendix shows the limitations of S T L as implemented in Microsoft Visual C++ 6. 0 and how to overcome them. Overall, < I> Effective S T L is a really invaluable source of programming expertise on an essential aspect of today's C++ for anyone who is using-or planning to use-S T L in real production code. It is quite simply a must-have. < I>-Richard Dragan < B> Topics covered: Introduction to advanced Standard Template Library ( S T L) programming techniques 50 tips and best practices for S T L illustrated with sample tutorial code Choosing containers Efficient copying of elements inside containers Removing, erasing, and cleaning up items from containers Using custom allocators with S T L containers Thread safety with S T L Tips for programming with the S T L < I>vector and < I>string classes (including reserving memory and calling legacy C/ C++ code) Tips for associative containers (including comparing items, sorted vectors, and non-standard enhancements to S T L) Tips for selecting and using S T L iterator classes S T L algorithms (including sorting, removing, and comparing items) Using functors with S T L General tips for S T L programming (including advice for choosing algorithms and understanding compiler diagnostic messages) String locales Overcoming S T L imitations in Microsoft Visual C++ 6. 0
|