Scott Meyers Training Courses
Concepts and Architecture of the STL
C++'s Standard Template Library (STL) is uniquely powerful and extensible, and it facilitates the creation of very efficient code. However, the design behind the STL is unconventional and can be counterintuitive. Developers who fail to grasp the design often produce software that looks reasonable, but that's actually brittle, inefficient, and home to subtle bugs.
This seminar illuminates the architecture that underlies the STL: its fundamental concepts, components, and how they relate to one another. The class also offers specific guidelines explaining how to make effective use of the STL and its architecture.
Course Highlights
Participants will gain:
- An understanding of the architecture behind the STL, including its core components and concepts.
- Usage guidelines that explain how to avoid subtle STL correctness and performance traps.
- An understanding of the applications and limitations of STL allocators.
Who Should Attend
Anybody working with C++ is a good candidate for this seminar, regardless of whether they are a systems designer, programmer, or technical manager. Participants should be comfortable with the basics of C++ (including templates), but expertise is not required. No STL experience is necessary, and even developers who've long used the STL as a containers library will come away from this seminar with useful, practical, proven insights.
Format
Lecture and question/answer. There are no hands-on exercises, but participants are welcome to use their computers to experiment with the course material as it is presented.
Length
One full day (six to seven lecture hours).
Detailed Topic Outline
- Preface: TR1 and Boost
- The Architecture of the STL:
- Arrays and pointers, half-open ranges
- Generalizing pointers to iterators
- Generalizing arrays to sequences
- Algorithms
- Conventions and extensibility
- Function objects
- Meanings of "The STL"
- Standard STL Containers:
- Sequence vs. associative containers
- Contiguous-memory vs. node-based containers
- Variations in string implementations
- The Behavior of remove:
- remove and containers of pointers
- Equality vs. Equivalence
- Algorithm Calls vs. Hand-Written Loops:
- Efficiency
- Correctness
- Comprehensibility
- Pragmatic considerations
- Inheritance vs. Templates:
- Explicit vs. implicit interfaces
- Runtime vs. compile-time polymorphism
- Allocators:
- Original goals and ultimate limitations
- Allocators vs. operators new/new[]/delete/delete[]
- Node-based containers and rebind
- Legitimate uses of allocators
- A shared-memory allocator
- A complete sample allocator
- Further Reading
For more information on this course, contact Scott directly.
