You are previewing Extended STL, Volume 1: Collections and Iterators.
O'Reilly logo
Extended STL, Volume 1: Collections and Iterators

Book Description

“Wilson’s menu of STL treatments will no doubt be good eating for generic programming adherents, ardent C programmers just now taking on STL and C++, Java programmers taking a second look at C++, and authors of libraries targeting multiple platforms and languages. Bon appetit!”
--George Frazier, Cadence Design Systems, Inc.

“A thorough treatment of the details and caveats of STL extension.”
--Pablo Aguilar, C++ Software Engineer

“This book is not just about extending STL, it’s also about extending my thinking in C++.”
--Serge Krynine, C++ Software Engineer, RailCorp Australia

“You might not agree 100% with everything Wilson has to say, but as a whole his book is the most valuable, in-depth study of practical STL-like programming.”
--Thorsten Ottosen, M.C.S., Boost Contributor

“Wilson is a master lion tamer, persuading multifarious third-party library beasts to jump through STL hoops. He carefully guides the reader through the design considerations, pointing out the pitfalls and making sure you don't get your head bitten off.”
--Adi Shavit, Chief Software Architect, EyeTech Co. Ltd

“Wilson’s book provides more than enough information to change the angst/uncertainty level of extending STL from ‘daunting’ to ‘doable.’ ”
--Garth Lancaster, EDI/Automation Manager, Business Systems Group, MBF Australia

“This book will open up your eyes and uncover just how powerful STL’s abstractions really are.”
--Nevin “:-)” Liber, 19-year veteran of C++

“In the canon of C++ there are very few books that extend the craft. Wilson’s work consistently pushes the limits, showing what can and cannot be done, and the tradeoffs involved.”
--John O’Halloran, Head of Software Development, Mediaproxy

“Essential concepts and practices to take the working programmer beyond the standard library.”
--Greg Peet

Extended STL is not just a book about adapting the STL to fit in with your everyday work, it’s also an odyssey through software design and concepts, C++ power techniques, and the perils of real-world software development--in other words, it’s a Matthew Wilson book. If you're serious about C++, I think you should read it.”
--Björn Karlsson, Principle Architect, ReadSoft; author of Beyond the C++ Standard Library: An Introduction to Boost

In Extended STL, renowned C++ expert Matthew Wilson shows how to go beyond the C++ standard and extend the Standard Template Library into the wider C++ world of APIs and non-standard collections, to write software that is more efficient, expressive, flexible, and robust.

In Volume 1, Wilson’s innovative techniques help you master STL extension in two important areas: adapting technology-specific libraries and operating system APIs to STL-compliant collections, and defining sophisticated iterator adaptors with which the latent efficiency and expressive power of STL can be realized. Using real-world examples, Wilson illustrates several powerful concepts and techniques that enable you to extend STL in directions never envisioned by its creators, including collections, element reference categories, external iterator invalidation and inferred interface adaptation.

Extended STL, Volume 1, will be an invaluable resource for every C++ programmer who is at least minimally familiar with the STL.

  • 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

  • Specific coverage includes

  • Making the most of collections, and understanding how they differ from containers

  • Mastering element reference categories: defining them, detecting them, and using them to design STL extension collections and iterators

  • Working with external iterator invalidation, and understanding its surprising impact on the design of STL-compatible collections

  • Adapting real-world APIs ranging from file

  • system enumeration to scatter/gather I/O

  • Using standalone iterator types, from simple std::ostream_iterator extensions to sophisticated adaptors that filter and transform types or values

  • The accompanying CD-ROM contains an extensive collection of open-source libraries created by the author. Also included: several test projects, and three bonus chapters.

    Table of Contents

    1. Copyright
      1. Dedication
    2. Praise for Extended STL, Volume 1
    3. Preface
      1. Aims
      2. Subject Matter
      3. Structure
        1. Part One: Foundations
        2. Part Two: Collections
        3. Part Three: Iterators
        4. Volume 2
      4. Supplementary Material
        1. CD-ROM
        2. Online Resources
    4. Acknowledgments
      1. Parachutes: Coda
    5. About the Author
    6. Prologue
      1. A Dichotomy of Character
      2. Principles of UNIX Programming
      3. Seven Signs of Successful C++ Software Libraries
        1. Efficiency
        2. Discoverability and Transparency
        3. Expressiveness
        4. Robustness
        5. Flexibility
        6. Modularity
        7. Portability
      4. Balancing the Signs: Satisfiction, Dialecticism, and Idioms Old and New
      5. Example Libraries
        1. STLSoft
        2. STLSoft Subprojects
        3. Boost
        4. Open-RJ
        5. Pantheios
        6. recls
    7. Presentation Conventions
      1. Fonts
      2. . . . versus . . .
      3. End Iterator Precomputation
      4. Nested Class Type Qualification
      5. NULL
      6. Template Parameter Names
      7. Member and Namespace-Scope Type Names
      8. Calling Conventions
      9. Endpoint Iterators
      10. Namespace for Standard C Names
      11. Class Adaptors and Instance Adaptors
      12. Header File Names
    8. One. Foundations
      1. 1. The Standard Template Library
        1. 1.1. Core Concepts
        2. 1.2. Containers
          1. 1.2.1. Sequence Containers
          2. 1.2.2. Associative Containers
          3. 1.2.3. Contiguity of Storage
          4. 1.2.4. swap
        3. 1.3. Iterators
          1. 1.3.1. Input Iterators
          2. 1.3.2. Output Iterators
          3. 1.3.3. Forward Iterators
          4. 1.3.4. Bidirectional Iterators
          5. 1.3.5. Random Access Iterators
          6. 1.3.6. Member Selection Operator
          7. 1.3.7. Predefined Iterator Adaptors
        4. 1.4. Algorithms
        5. 1.5. Function Objects
        6. 1.6. Allocators
      2. 2. Extended STL Concepts, or When STL Meets the Real World
        1. 2.1. Terminology
        2. 2.2. Collections
          1. 2.2.1. Mutability
        3. 2.3. Iterators
          1. 2.3.1. Mutability
          2. 2.3.2. Traversal
          3. 2.3.3. Compile-Time Characteristic Determination
          4. 2.3.4. Element Reference Category
          5. 2.3.5. State Sharing versus Independence
          6. 2.3.6. Revising the Iterator Refinement Taxonomy?
      3. 3. Element Reference Categories
        1. 3.1. Introduction
        2. 3.2. C++ References
          1. 3.2.1. STL Container Element References
        3. 3.3. A Taxonomy of Element Reference Categories
          1. 3.3.1. Permanent
          2. 3.3.2. Fixed
          3. 3.3.3. Invalidatable
          4. 3.3.4. Transient
          5. 3.3.5. By-Value Temporary
          6. 3.3.6. Void
        4. 3.4. Using Element Reference Categories
          1. 3.4.1. Detecting Category Flavors at Compile Time
          2. 3.4.2. Using the Compiler to Avoid Undefined Iterator Behavior
        5. 3.5. Defining operator ->()
        6. 3.6. Element Reference Categories: Coda
      4. 4. The Curious Untemporary Reference
      5. 5. The DRY SPOT Principle
        1. 5.1. DRY SPOTs in C++
          1. 5.1.1. Constants
          2. 5.1.2. dimensionof()
          3. 5.1.3. Creator Functions
        2. 5.2. Not Quite DRY SPOTs in C++
          1. 5.2.1. Parent Classes
          2. 5.2.2. Function Return Types
        3. 5.3. Closed Namespaces
      6. 6. The Law of Leaky Abstractions
      7. 7. Contract Programming
        1. 7.1. Enforcement Types
        2. 7.2. Enforcement Mechanisms
      8. 8. Constraints
        1. 8.1. Type System Leverage
        2. 8.2. Static Assertions
      9. 9. Shims
        1. 9.1. Introduction
        2. 9.2. Primary Shims
          1. 9.2.1. Attribute Shims
          2. 9.2.2. Conversion Shims
        3. 9.3. Composite Shims
          1. 9.3.1. String Access Shims
      10. 10. Duck and Goose, or the Whimsical Bases of Partial Structural Conformance
        1. 10.1. Conformance
          1. 10.1.1. Named Conformance
          2. 10.1.2. Structural Conformance
          3. 10.1.3. Duck and Goose
        2. 10.2. Explicit Semantic Conformance
          1. 10.2.1. Concepts
          2. 10.2.2. Member Type Tagging
          3. 10.2.3. Shims
        3. 10.3. Intersecting Conformance
      11. 11. RAII
        1. 11.1. Mutability
        2. 11.2. Resource Source
      12. 12. Template Tools
        1. 12.1. Traits
          1. 12.1.1. base_type_traits
          2. 12.1.2. sign_traits
          3. 12.1.3. Type Characteristics: Mini-Traits
          4. 12.1.4. is_integral_type
          5. 12.1.5. is_signed_type
          6. 12.1.6. is_fundamental_type
          7. 12.1.7. is_same_type
        2. 12.2. Type Generators
          1. 12.2.1. stlsoft::allocator_selector
        3. 12.3. True Typedefs
      13. 13. Inferred Interface Adaptation: Compile-Time Adaptation of Interface-Incomplete Types
        1. 13.1. Introduction
        2. 13.2. Adapting Interface-Incomplete Types
        3. 13.3. Adapting Immutable Collections
        4. 13.4. Inferred Interface Adaptation
          1. 13.4.1. Type Selection
          2. 13.4.2. Type Detection
          3. 13.4.3. Type Fixing
        5. 13.5. Applying IIA to the Range
      14. 14. Henney’s Hypothesis, or When Templates Attack!
      15. 15. The Independent Autonomies of equal() Friends
        1. 15.1. Beware Nonmember Friend Function Abuse
        2. 15.2. Collections and Their Iterators
      16. 16. Essential Components
        1. 16.1. Introduction
        2. 16.2. auto_buffer
          1. 16.2.1. It’s Not a Container!
          2. 16.2.2. Class Interface
          3. 16.2.3. Copying
          4. 16.2.4. Nice Allocators Go Last
          5. 16.2.5. swap()
          6. 16.2.6. Performance
        3. 16.3. filesystem_traits
          1. 16.3.1. Member Types
          2. 16.3.2. General String Handling
          3. 16.3.3. File System Name Handling
          4. 16.3.4. File System State Operations
          5. 16.3.5. File System Control Operations
          6. 16.3.6. Return Types and Error Handling
        4. 16.4. file_path_buffer
          1. 16.4.1. basic_??
          2. 16.4.2. UNIX and PATH_MAX
          3. 16.4.3. Windows and MAX_PATH
          4. 16.4.4. Using the Buffers
        5. 16.5. scoped_handle
        6. 16.6. dl_call()
    9. Two. Collections
      1. 17. Adapting the glob API
        1. 17.1. Introduction
          1. 17.1.1. Motivation
          2. 17.2. The glob API
        2. 17.2. Decomposition of the Longhand Version
        3. 17.3. unixstl::glob_sequence
          1. 17.3.1. Public Interface
          2. 17.3.2. Member Types
          3. 17.3.3. Member Variables
          4. 17.3.4. Flags
          5. 17.3.5. Construction
          6. 17.3.6. Size and Element Access
          7. 17.3.7. Iteration
          8. 17.3.8. init_glob_()
        4. 17.4. Decomposition of the Shorthand Version
        5. 17.5. Summary
      2. 18. Intermezzo: Constructor Clashes and Design That Is, If Not Bad, At Least Ill-Conceived for Seamless Evolution
      3. 19. Adapting the opendir/readdir API
        1. 19.1. Introduction
          1. 19.1.1. Motivation
          2. 19.1.2. The opendir/readdir API
        2. 19.2. Decomposition of the Longhand Version
        3. 19.3. unixstl::readdir_sequence
          1. 19.3.1. Member Types and Constants
          2. 19.3.2. Construction
          3. 19.3.3. Iteration and Size Methods
          4. 19.3.4. Attribute Methods
          5. 19.3.5. const_iterator, Version 1
          6. 19.3.6. Using Version 1
          7. 19.3.7. const_iterator, Version 2: Copy Semantics
          8. 19.3.8. operator ++()
          9. 19.3.9. Iterator Category and Adaptable Member Types
          10. 19.3.10. operator ->()
          11. 19.3.11. Supporting fullPath and absolutePath
        4. 19.4. Alternate Implementations
          1. 19.4.1. Storing the Elements as a Snapshot
          2. 19.4.2. Storing the Elements as an Iterator
        5. 19.5. Summary
      4. 20. Adapting the FindFirstFile/FindNextFile API
        1. 20.1. Introduction
          1. 20.1.1. Motivation
          2. 20.1.2. The FindFirstFile/FindNextFile API
        2. 20.2. Decomposition of Examples
          1. 20.2.1. Longhand Version
          2. 20.2.2. Shorthand Version
          3. 20.2.3. Reparse Points and Infinite Recursion
        3. 20.3. Sequence Design
        4. 20.4. winstl::basic_findfile_sequence
          1. 20.4.1. Class Interface
          2. 20.4.2. Construction
          3. 20.4.3. Iteration
          4. 20.4.4. Exception Agnosticism
        5. 20.5. winstl::basic_findfile_sequence_const_iterator
          1. 20.5.1. Construction
          2. 20.5.2. find_first_file_()
          3. 20.5.3. operator ++()
        6. 20.6. winstl::basic_findfile_sequence_value_type
        7. 20.7. Shims
        8. 20.8. What, No Shims and Constructor Templates?
        9. 20.9. Summary
        10. 20.10. File System Enumeration with recls: Coda
      5. 21. Intermezzo: When the Efficiency/Usability Balance Is Tipped: Enumerating FTP Server Directories
        1. 21.1. inetstl::basic_findfile_sequence
        2. 21.2. inetstl::basic_ftpdir_sequence
      6. 22. Enumerating Processes and Modules
        1. 22.1. Collection Characteristics
        2. 22.2. winstl::pid_sequence
          1. 22.2.1. Simple Compositional Implementations
          2. 22.2.2. Acquiring the Process Identifiers
          3. 22.2.3. Working without Exception Support
        3. 22.3. winstl::process_module_sequence
        4. 22.4. Enumerating All Modules on a System
        5. 22.5. Avoiding the System Pseudo Processes
        6. 22.6. Handling Optional API Headers
        7. 22.7. Summary
      7. 23. The Fibonacci Sequence
        1. 23.1. Introduction
        2. 23.2. The Fibonacci Sequence
        3. 23.3. Fibonacci as an STL Sequence
          1. 23.3.1. Interface of an Infinite Sequence
          2. 23.3.2. Put a Contract on It
          3. 23.3.3. Changing Value Type?
          4. 23.3.4. Constraining Type
          5. 23.3.5. Throw std::overflow_error?
        4. 23.4. Discoverability Failure
        5. 23.5. Defining Finite Bounds
          1. 23.5.1. Iterators Rule After All?
          2. 23.5.2. Constructor-Bound Range
          3. 23.5.3. True Typedefs
        6. 23.6. Summary
      8. 24. Adapting MFC’s CArray Container Family
        1. 24.1. Introduction
        2. 24.2. Motivation
        3. 24.3. Emulating std::vector
        4. 24.4. Design Considerations
          1. 24.4.1. MFC’s Array Container Family
          2. 24.4.2. CArray_traits
          3. 24.4.3. Design of the Array Adaptor Classes
          4. 24.4.4. Abstract Manipulation of State
          5. 24.4.5. Copy-and-Swap Idiom
          6. 24.4.6. Collection-Interface Composition
          7. 24.4.7. Pedagogical Approach
        5. 24.5. mfcstl::CArray_adaptor_base Interface
        6. 24.6. mfcstl::CArray_cadaptor
          1. 24.6.1. Template Declaration and Inheritance
          2. 24.6.2. Applying CRTP
          3. 24.6.3. Construction
          4. 24.6.4. operator []()
        7. 24.7. mfcstl::CArray_iadaptor
        8. 24.8. Construction
        9. 24.9. Allocator
        10. 24.10. Element Access Methods
        11. 24.11. Iteration
          1. 24.11.1. begin() and end()
          2. 24.11.2. rbegin() and rend()
        12. 24.12. Size
          1. 24.12.1. Memory Allocation Optimization
        13. 24.13. Capacity
        14. 24.14. Comparison
        15. 24.15. Modifiers
          1. 24.15.1. push_back()
          2. 24.15.2. assign()
          3. 24.15.3. pop_back() and clear()
          4. 24.15.4. erase()
          5. 24.15.5. insert()
        16. 24.16. Assignment and swap()
          1. 24.16.1. swap()
        17. 24.17. Summary
        18. 24.18. On the CD
      9. 25. A Map of the Environment
        1. 25.1. Introduction
        2. 25.2. Motivation
        3. 25.3. getenv(), putenv(), setenv()/unsetenv(), and environ
        4. 25.4. platformstl::environment_variable_traits
        5. 25.5. Planning the Interface
        6. 25.6. Lookup by Name
          1. 25.6.1. Option 1: Return a Fixed/Transient Reference to a Cached Object with an Up-to-Date Value
          2. 25.6.2. Option 2: Return a Fixed Reference to a Cached Object with a Snapshot Value
          3. 25.6.3. Option 3: Return a Fixed Reference to a Cached Object with an Up-to-Date Value
          4. 25.6.4. Option 4: Return a By-Value Temporary Reference with an Up-to-Date Value
          5. 25.6.5. Lookup by Name: Coda
        7. 25.7. Inserting, Updating, and Deleting Values by Name
        8. 25.8. Iteration
          1. 25.8.1. Version 1: Contiguous Iterator
          2. 25.8.2. Version 2: Bidirectional Iterator
          3. 25.8.3. Version 3: Snapshot
          4. 25.8.4. Version 4: Reference-Counted Snapshot
        9. 25.9. Final Iteration Implementation
          1. 25.9.1. Mutable Snapshot?
          2. 25.9.2. Creating the Snapshot
          3. 25.9.3. const_iterator Nested Class
          4. 25.9.4. insert() Method
          5. 25.9.5. erase() Method
          6. 25.9.6. operator []() and lookup()
          7. 25.9.7. snapshot Nested Class
        10. 25.10. Heterogeneous Reference Categories?
        11. 25.11. size() and Subscript by Index
        12. 25.12. Summary
        13. 25.13. On the CD
      10. 26. Traveling Back and Forth on the Z-Plane
        1. 26.1. Prologue
        2. 26.2. Introduction
        3. 26.3. Version 1: Forward Iteration
          1. 26.3.1. zorder_iterator, Version 1
          2. 26.3.2. window_peer_sequence, Version 1
        4. 26.4. Version 2: Bidirectional Iteration
        5. 26.5. Handling External Change
          1. 26.5.1. stlsoft::external_iterator_invalidation
        6. 26.6. winstl::child_window_sequence
        7. 26.7. Bidirectional Iterator Blues
          1. 26.7.1. end() Sentinels Gotcha
          2. 26.7.2. Deadly Double Dereference
          3. 26.7.3. When a Bidirectional Iterator Is Not a Forward Iterator but a Reversible Cloneable Iterator
        8. 26.8. winstl::zorder_iterator: A Reversal of Self
          1. 26.8.1. zorder_iterator Traits
          2. 26.8.2. zorder_iterator_tmpl<>
          3. 26.8.3. Reversed Semantics
        9. 26.9. Finalizing the Window Peer Sequences
        10. 26.10. Summary
        11. 26.11. Z-Plane: Coda
      11. 27. String Tokenization
        1. 27.1. Introduction
        2. 27.2. strtok()
        3. 27.3. SynesisSTL::StringTokeniser
        4. 27.4. Tokenization Use Cases
        5. 27.5. Other Tokenization Alternatives
          1. 27.5.1. strtok_r()
          2. 27.5.2. IOStreams
          3. 27.5.3. stlsoft::find_next_token()
          4. 27.5.4. boost::tokenizer
        6. 27.6. stlsoft::string_tokeniser
          1. 27.6.1. stlsoft::string_tokeniser::const_iterator
          2. 27.6.2. Selecting Categories
          3. 27.6.3. stlsoft::string_tokeniser_type_traits
          4. 27.6.4. stlsoft::string_tokeniser_comparator
        7. 27.7. Test Drive
          1. 27.7.1. Single-Character Delimiter
          2. 27.7.2. Composite String Delimiter
          3. 27.7.3. Preserving Blanks
          4. 27.7.4. Copying versus Referencing: Considering Views
            1. 27.7.4.1. s = view, v = view
            2. 27.7.4.2. s = string, v = view
            3. 27.7.4.3. s = view, v = string
            4. 27.7.4.4. s = string, v = string
          5. 27.7.5. Character Set Delimiter
        8. 27.8. The Policy Folly
          1. 27.8.1. Refactoring Template Parameters via Inheritance
          2. 27.8.2. Type Generator Templates
          3. 27.8.3. Handling Henney’s Hypothesis
        9. 27.9. Performance
        10. 27.10. Summary
      12. 28. Adapting COM Enumerators
        1. 28.1. Introduction
        2. 28.2. Motivation
          1. 28.2.1. Longhand Version
          2. 28.2.2. Shorthand Version
        3. 28.3. COM Enumerators
          1. 28.3.1. IEnumXXXX::Next()
          2. 28.3.2. IEnumXXXX::Skip()
          3. 28.3.3. IEnumXXXX::Reset()
          4. 28.3.4. IEnumXXXX::Clone()
          5. 28.3.5. Different Value Types
        4. 28.4. Decomposition of the Longhand Version
        5. 28.5. comstl::enumerator_sequence
          1. 28.5.1. Public Interface
          2. 28.5.2. Member Types and Constants
          3. 28.5.3. Value Policies
          4. 28.5.4. Member Variables
          5. 28.5.5. Construction
          6. 28.5.6. Iteration Methods
          7. 28.5.7. const-Incorrect Iterator Methods?
          8. 28.5.8. Breaking Value Semantics?
        6. 28.6. comstl::enumerator_sequence::iterator
          1. 28.6.1. Construction
          2. 28.6.2. Iteration Methods
          3. 28.6.3. equal()
        7. 28.7. comstl::enumerator_sequence::iterator::enumeration_context
          1. 28.7.1. Why an Enumeration Context?
          2. 28.7.2. Class Definition
          3. 28.7.3. Construction
          4. 28.7.4. Iterator Support Methods
          5. 28.7.5. Invariant
        8. 28.8. Iterator Cloning Policies
          1. 28.8.1. comstl::input_cloning_policy
          2. 28.8.2. comstl::forward_cloning_policy
          3. 28.8.3. comstl::cloneable_cloning_policy
        9. 28.9. Choosing a Default Cloning Policy: Applying the Principle of Least Surprise
          1. 28.9.1. empty()
        10. 28.10. Summary
          1. 28.10.1. Why Not Default to Forward Iterators?
          2. 28.10.2. Why Not Default to Input Iterators?
          3. 28.10.3. Why Not Have a Fixed Quanta of 1?
          4. 28.10.4. Why Not Use a Standard Container?
        11. 28.11. Coming Next
      13. 29. Intermezzo: Correcting Minor Design Omissions with Member Type Inference
      14. 30. Adapting COM Collections
        1. 30.1. Introduction
        2. 30.2. Motivation
          1. 30.2.1. Longhand Version
          2. 30.2.2. Shorthand Version
        3. 30.3. comstl::collection_sequence
          1. 30.3.1. Public Interface
          2. 30.3.2. Member Types and Constants
          3. 30.3.3. Construction
          4. 30.3.4. Iteration: Using a Dirty Trick Cleanly
          5. 30.3.5. size()?
        4. 30.4. Enumerator Acquisition Policies
        5. 30.5. Summary
      15. 31. Gathering Scattered I/O
        1. 31.1. Introduction
        2. 31.2. Scatter/Gather I/O
        3. 31.3. Scatter/Gather I/O APIs
          1. 31.3.1. Linearizing with COM Streams
          2. 31.3.2. platformstl::scatter_slice_sequence—A Teaser Trailer
        4. 31.4. Adapting ACE_Message_Queue
          1. 31.4.1. acestl::message_queue_sequence, Version 1
          2. 31.4.2. acestl::message_queue_sequence::iterator
        5. 31.5. Time for Some Cake
          1. 31.5.1. But Captain, I Canna’ Mek Her Goo Any Fastah!
          2. 31.5.2. acestl::message_queue_sequence, Version 2
          3. 31.5.3. Specializing the Standard Library
          4. 31.5.4. Performance
        6. 31.6. Summary
      16. 32. Argument-Dependent Return-Type Variance
        1. 32.1. Introduction
        2. 32.2. Borrowing a Jewel from Ruby
        3. 32.3. Dual-Semantic Subscripting in C++
        4. 32.4. Generalized Compatibility via String Access Shims
        5. 32.5. A Fly in the int-ment
        6. 32.6. Selecting Return Type and Overload
          1. 32.6.1. Proscribing Signed Subscript Indexes
        7. 32.7. Summary
      17. 33. External Iterator Invalidation
        1. 33.1. Element-Interface Coherence
        2. 33.2. Windows ListBox and ComboBox Controls
          1. 33.2.1. Retrieval Races?
          2. 33.2.2. WinSTL listbox_sequence and combobox_sequence Classes
        3. 33.3. Enumerating Registry Keys and Values
          1. 33.3.1. So What’s the Problem?
          2. 33.3.2. The WinSTL Registry Library
          3. 33.3.3. Handling External Iterator Invalidation
          4. 33.3.4. winstl::basic_reg_key_sequence
        4. 33.4. Summary
        5. 33.5. On the CD
    10. Three. Iterators
      1. 34. An Enhanced ostream_iterator
        1. 34.1. Introduction
        2. 34.2. std::ostream_iterator
          1. 34.2.1. void Difference Type
        3. 34.3. stlsoft::ostream_iterator
          1. 34.3.1. Shims, Naturally
          2. 34.3.2. Safe Semantics
          3. 34.3.3. std::ostream_iterator Compatibility
          4. 34.3.4. A Clash of Design Principles?
        4. 34.4. Defining Stream Insertion Operators
        5. 34.5. Summary
      2. 35. Intermezzo: Proscribing Fatuous Output Iterator Syntax Using the Dereference Proxy Pattern
        1. 35.1. stlsoft::ostream_iterator::deref_proxy
      3. 36. Transform Iterator
        1. 36.1. Introduction
        2. 36.2. Motivation
          1. 36.2.1. Using std::transform()
          2. 36.2.2. Using the Transform Iterator
        3. 36.3. Defining Iterator Adaptors
          1. 36.3.1. Creator Functions
          2. 36.3.2. Value Type
        4. 36.4. stlsoft::transform_iterator
          1. 36.4.1. Version 1
          2. 36.4.2. Construction
          3. 36.4.3. Increment and Decrement Operators and Pointer Arithmetic Methods
          4. 36.4.4. Comparison and Arithmetic Operators
          5. 36.4.5. And the Problem Is . . .
          6. 36.4.6. Version 2
          7. 36.4.7. stlsoft::transform_iterator
        5. 36.5. Composite Transformations
        6. 36.6. DRY SPOTViolations?
          1. 36.6.1. Use Typedefs and Nontemporary Function Objects
          2. 36.6.2. Use Heterogeneous Iterators and Algorithms
          3. 36.6.3. Wear It, but Beware
        7. 36.7. A Spoonful of Sequence Helps the Medicine . . . ?
        8. 36.8. Summary
        9. 36.9. On the CD
      4. 37. Intermezzo: Discretion Being the Better Part of Nomenclature . . .
      5. 38. Member Selector Iterator
        1. 38.1. Introduction
        2. 38.2. Motivation
          1. 38.2.1. std::accumulate()
        3. 38.3. stlsoft::member_selector_iterator
        4. 38.4. Creator Function Woes
          1. 38.4.1. Nonmutating Access to a Non-const Array
          2. 38.4.2. Nonmutating Access to a const Array
          3. 38.4.3. Mutating Access to a Non-const Array
          4. 38.4.4. Nonmutating Access to a Non-const Collection with Class-Type Iterators
          5. 38.4.5. Nonmutating Access to a const Collection with Class-Type Iterators
          6. 38.4.6. Mutating Access to a Collection with Class-Type Iterators
          7. 38.4.7. Selecting const members
        5. 38.5. Summary
        6. 38.6. On the CD
      6. 39. C-Style String Concatenation
        1. 39.1. Motivation
        2. 39.2. An Inflexible Version
        3. 39.3. stlsoft::cstring_concatenator_iterator
        4. 39.4. Creator Functions
        5. 39.5. Summary
        6. 39.6. On the CD
      7. 40. String Object Concatenation
        1. 40.1. Introduction
        2. 40.2. stlsoft::string_concatenator_iterator
        3. 40.3. Heterogeneity of String Types
        4. 40.4. But . . .
          1. 40.4.1. Assignability
          2. 40.4.2. Dangling References
          3. 40.4.3. Solution
        5. 40.5. Summary
      8. 41. Adapted Iterators Traits
        1. 41.1. Introduction
        2. 41.2. stlsoft::adapted_iterator_traits
          1. 41.2.1. iterator_category
          2. 41.2.2. value_type
          3. 41.2.3. difference_type
          4. 41.2.4. pointer
          5. 41.2.5. reference
          6. 41.2.6. const_pointer and const_reference
          7. 41.2.7. effective_reference and effective_const_reference
          8. 41.2.8. effective_pointer and effective_const_pointer
          9. 41.2.9. Using the Traits
        3. 41.3. Summary
        4. 41.4. On the CD
      9. 42. Filtered Iteration
        1. 42.1. Introduction
        2. 42.2. An Invalid Version
        3. 42.3. Member Iterators Define the Range
        4. 42.4. So . . . ?
        5. 42.5. stlsoft::filter_iterator
          1. 42.5.1. Forward Iterator Semantics
          2. 42.5.2. Bidirectional Iterator Semantics
          3. 42.5.3. Random Access Iterator Semantics
        6. 42.6. Constraining the Iterator Category
        7. 42.7. Summary
        8. 42.8. On the CD
      10. 43. Composite Iterator Adaptations
        1. 43.1. Introduction
        2. 43.2. Transforming a Filtered Iterator
          1. 43.2.1. Creator Function
        3. 43.3. Filtering a Transformed Iterator
        4. 43.4. Hedging Our Bets
        5. 43.5. Summary
    11. Epilogue
    12. Bibliography
      1. Publications about STL:
      2. Books about other things:
    13. CD-ROM Warranty