Extended STL, Volume 1 : collections and iterators / Matthew Wilson.
Includes bibliographical references and index.
ISBN 0-321-30550-7 (pbk. : alk. paper)
1. C++ (Computer prog
ram language) 2. Standard template library. I. Title.
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
. 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
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
. 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
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
. 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...展开收缩