Effective STL 50 specific way to improve your use of the standard template library


Author : Scott Meyers

Published in : Addison Wesley Professional Computing Series

ISBN : 978-0201749625

File Type : pdf

File Size : 1 Mb

Language : English


Sure, the STL has iterators, algorithms, and function objects, but for most C++ programmers, it's the containers that stand out. More powerful and flexible than arrays, they grow (and often shrink) dynamically, manage their own memory, keep track of how many objects they hold, bound the algorithmic complexity of the operations they support, and much, much more. Their popularity is easy to understand. They're simply better than their competition, regardless of whether that competition comes from containers in other libraries or is a container type you'd write yourself. STL containers aren't just good. They're really good.
This chapter is devoted to guidelines applicable to all the STL containers. Later chapters focus on specific container types. The topics addressed here include selecting the appropriate container given the constraints you face: avoiding the delusion that code written for one container type is likely to work with other container types: the significance of copying operations for objects in containers: difficulties that arise when pointers of auto_ptrs are stored in containers: the ins and outs of erasing: what you can and cannot accomplish with custom allocators: tips on how to maximize efficiency: and considerations for using containers in a threaded environment.
Similar Books