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
- Copyright
- Praise for Extended STL, Volume 1
- Preface
- Acknowledgments
- About the Author
- Prologue
- Presentation Conventions
-
One. Foundations
- 1. The Standard Template Library
- 2. Extended STL Concepts, or When STL Meets the Real World
- 3. Element Reference Categories
- 4. The Curious Untemporary Reference
- 5. The DRY SPOT Principle
- 6. The Law of Leaky Abstractions
- 7. Contract Programming
- 8. Constraints
- 9. Shims
- 10. Duck and Goose, or the Whimsical Bases of Partial Structural Conformance
- 11. RAII
- 12. Template Tools
- 13. Inferred Interface Adaptation: Compile-Time Adaptation of Interface-Incomplete Types
- 14. Henney’s Hypothesis, or When Templates Attack!
- 15. The Independent Autonomies of equal() Friends
- 16. Essential Components
-
Two. Collections
- 17. Adapting the glob API
- 18. Intermezzo: Constructor Clashes and Design That Is, If Not Bad, At Least Ill-Conceived for Seamless Evolution
-
19. Adapting the opendir/readdir API
- 19.1. Introduction
- 19.2. Decomposition of the Longhand Version
-
19.3. unixstl::readdir_sequence
- 19.3.1. Member Types and Constants
- 19.3.2. Construction
- 19.3.3. Iteration and Size Methods
- 19.3.4. Attribute Methods
- 19.3.5. const_iterator, Version 1
- 19.3.6. Using Version 1
- 19.3.7. const_iterator, Version 2: Copy Semantics
- 19.3.8. operator ++()
- 19.3.9. Iterator Category and Adaptable Member Types
- 19.3.10. operator ->()
- 19.3.11. Supporting fullPath and absolutePath
- 19.4. Alternate Implementations
- 19.5. Summary
-
20. Adapting the FindFirstFile/FindNextFile API
- 20.1. Introduction
- 20.2. Decomposition of Examples
- 20.3. Sequence Design
- 20.4. winstl::basic_findfile_sequence
- 20.5. winstl::basic_findfile_sequence_const_iterator
- 20.6. winstl::basic_findfile_sequence_value_type
- 20.7. Shims
- 20.8. What, No Shims and Constructor Templates?
- 20.9. Summary
- 20.10. File System Enumeration with recls: Coda
- 21. Intermezzo: When the Efficiency/Usability Balance Is Tipped: Enumerating FTP Server Directories
- 22. Enumerating Processes and Modules
- 23. The Fibonacci Sequence
-
24. Adapting MFC’s CArray Container Family
- 24.1. Introduction
- 24.2. Motivation
- 24.3. Emulating std::vector
- 24.4. Design Considerations
- 24.5. mfcstl::CArray_adaptor_base Interface
- 24.6. mfcstl::CArray_cadaptor
- 24.7. mfcstl::CArray_iadaptor
- 24.8. Construction
- 24.9. Allocator
- 24.10. Element Access Methods
- 24.11. Iteration
- 24.12. Size
- 24.13. Capacity
- 24.14. Comparison
- 24.15. Modifiers
- 24.16. Assignment and swap()
- 24.17. Summary
- 24.18. On the CD
-
25. A Map of the Environment
- 25.1. Introduction
- 25.2. Motivation
- 25.3. getenv(), putenv(), setenv()/unsetenv(), and environ
- 25.4. platformstl::environment_variable_traits
- 25.5. Planning the Interface
-
25.6. Lookup by Name
- 25.6.1. Option 1: Return a Fixed/Transient Reference to a Cached Object with an Up-to-Date Value
- 25.6.2. Option 2: Return a Fixed Reference to a Cached Object with a Snapshot Value
- 25.6.3. Option 3: Return a Fixed Reference to a Cached Object with an Up-to-Date Value
- 25.6.4. Option 4: Return a By-Value Temporary Reference with an Up-to-Date Value
- 25.6.5. Lookup by Name: Coda
- 25.7. Inserting, Updating, and Deleting Values by Name
- 25.8. Iteration
- 25.9. Final Iteration Implementation
- 25.10. Heterogeneous Reference Categories?
- 25.11. size() and Subscript by Index
- 25.12. Summary
- 25.13. On the CD
-
26. Traveling Back and Forth on the Z-Plane
- 26.1. Prologue
- 26.2. Introduction
- 26.3. Version 1: Forward Iteration
- 26.4. Version 2: Bidirectional Iteration
- 26.5. Handling External Change
- 26.6. winstl::child_window_sequence
- 26.7. Bidirectional Iterator Blues
- 26.8. winstl::zorder_iterator: A Reversal of Self
- 26.9. Finalizing the Window Peer Sequences
- 26.10. Summary
- 26.11. Z-Plane: Coda
-
27. String Tokenization
- 27.1. Introduction
- 27.2. strtok()
- 27.3. SynesisSTL::StringTokeniser
- 27.4. Tokenization Use Cases
- 27.5. Other Tokenization Alternatives
- 27.6. stlsoft::string_tokeniser
- 27.7. Test Drive
- 27.8. The Policy Folly
- 27.9. Performance
- 27.10. Summary
-
28. Adapting COM Enumerators
- 28.1. Introduction
- 28.2. Motivation
- 28.3. COM Enumerators
- 28.4. Decomposition of the Longhand Version
- 28.5. comstl::enumerator_sequence
- 28.6. comstl::enumerator_sequence::iterator
- 28.7. comstl::enumerator_sequence::iterator::enumeration_context
- 28.8. Iterator Cloning Policies
- 28.9. Choosing a Default Cloning Policy: Applying the Principle of Least Surprise
- 28.10. Summary
- 28.11. Coming Next
- 29. Intermezzo: Correcting Minor Design Omissions with Member Type Inference
- 30. Adapting COM Collections
- 31. Gathering Scattered I/O
- 32. Argument-Dependent Return-Type Variance
- 33. External Iterator Invalidation
-
Three. Iterators
- 34. An Enhanced ostream_iterator
- 35. Intermezzo: Proscribing Fatuous Output Iterator Syntax Using the Dereference Proxy Pattern
- 36. Transform Iterator
- 37. Intermezzo: Discretion Being the Better Part of Nomenclature . . .
-
38. Member Selector Iterator
- 38.1. Introduction
- 38.2. Motivation
- 38.3. stlsoft::member_selector_iterator
-
38.4. Creator Function Woes
- 38.4.1. Nonmutating Access to a Non-const Array
- 38.4.2. Nonmutating Access to a const Array
- 38.4.3. Mutating Access to a Non-const Array
- 38.4.4. Nonmutating Access to a Non-const Collection with Class-Type Iterators
- 38.4.5. Nonmutating Access to a const Collection with Class-Type Iterators
- 38.4.6. Mutating Access to a Collection with Class-Type Iterators
- 38.4.7. Selecting const members
- 38.5. Summary
- 38.6. On the CD
- 39. C-Style String Concatenation
- 40. String Object Concatenation
- 41. Adapted Iterators Traits
- 42. Filtered Iteration
- 43. Composite Iterator Adaptations
- Epilogue
- Bibliography
- CD-ROM Warranty
Product information
- Title: Extended STL, Volume 1: Collections and Iterators
- Author(s):
- Release date: June 2007
- Publisher(s): Addison-Wesley Professional
- ISBN: 9780321305503
You might also like
book
Advanced Metaprogramming in Classic C++
Advanced Metaprogramming in Classic C++ aims to be both an introduction and a reference to C++ …
book
Practical C++ Metaprogramming
To say that C++ programmers embrace metaprogramming is a real stretch. Outright rejection is probably more …
book
Imperfect C++ Practical Solutions for Real-Life Programming
Imperfect C++ C++, although a marvelous language, isn't perfect. Matthew Wilson has been working with it …
book
C++20 for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners
Ready to learn programming with less effort and more fun? Then do it the lazy way! …