文件名称:Addison-Wesley.Extended STL,Volume.1.Collections and Iterators.pdf
文件大小:2.85MB
文件格式:PDF
更新时间:2010-09-12 08:40:50
collection iterator STL
Wilson, Matthew. Extended STL, Volume 1 : collections and iterators / Matthew Wilson. p. cm. Includes bibliographical references and index. ISBN 0-321-30550-7 (pbk. : alk. paper) 1. C++ (Computer program language) 2. Standard template library. I. Title. QA76.73.C153W55235 2007 005.13'3--dc22 2007016507 Copyright . 2007 Pearson Education, Inc. This book describes one good way to use and extend the STL. It defines the following: . The collection concept and how it differs from the container concept . The element reference category concept, including why it’s important, how it’s defined, how it’s detected, and the compromises it imposes on the design of STL extension collections and iterators . The phenomenon of external iterator invalidation and the implications of its surprising behavior on the design of STL-compatible collections . A mechanism for detecting features of arbitrary collections that may or may not provide mutating operations It explains several issues: . Why a transforming iterator adaptor must return elements by value . Why a filtering iterator must always be given a pair of iterators to manipulate . What to do if the underlying collection changes during iteration . Why you should proscribe meaningless syntax for your output iterator classes and how to do so using the Dereference Proxy pattern It demonstrates how to: . Adapt elements-en-bloc APIs to the STL collection concept . Adapt element-at-a-time APIs to the STL collection concept . Share enumeration state in order to properly fulfill the requirements of the input iterator concept . Enumerate potentially infinite collections . Specialize standard algorithms for specific iterator types to optimize performance . Define a safe, platform-independent STL extension for the system environment, implemented in terms of a global variable . Adapt a collection whose iterator instances’ copyability is determined at runtime . Provide access to a reversible collection that is not repeatable . Write into a character buffer using an iterator Extended STL addresses these issues and more. It also looks at how general-purpose, STLcompliant libraries may be built without sacrificing robustness, flexibility, and, especially, performance. Extended STL teaches you how to have your abstraction cake, with efficiency cream, and eat it. You should read this book if you want to: . Learn specific principles and techniques for STL extension . Learn more about the STL, by looking inside the implementation of STL extensions . Learn general techniques for implementing wrappers over operating system APIs and technology-specific libraries . Learn how to write iterator adaptors and understand the reasons behind the restrictions on their implementations and use . Pick up techniques for optimizing the performance of general-purpose libraries . Use proven software components for STL extension