Advanced STL Programming
"This was a very challenging course.
Instructor
kept students engaged and forced us to think."
- Developer
Description
This course describes
advanced features of the C++ standard template
library
(STL), techniques for extending the STL, the C++ language
features
and techniques used in its design.
The course focusses on
advanced STL features, including the
implementation
of iterator and function object adapters, and extending the STL through
new iterators, containers, allocators, and adapters. The course
also
covers advanced template programming techniques used in the STL design,
including template member functions, traits, compile-time algorithm
selection,
full and partial class template specialization, function template
argument
deduction for expanding class templates, and others.
The text contains extensive
notes sections that elaborate and expand
on the course material, and allow the text to be used as a reference.
Of
particular utility are numerous "gotcha" notes, set off by a special
symbol,
that show how to avoid subtle language and design errors. The course
includes
laboratory exercises and solutions.
Audience
This course is designed
to serve the needs of professional software
engineers
with C++ background equivalent to Introduction
to Object-Oriented Programming in C++, several months of
production
C++ experience, and experience with the STL equivalent to Introduction
to the C++ Standard Template Library.
Format
3 days, lecture/lab
or 2 days, lecture
This course may be
customized to the individual client's application
domain, project, staff experience level, and scheduling requirements.
Outline
- Adapters
- function object adapters
- binders and negaters
- helper tempates and template argument deduction
- pointer to function adapters
- composing new function objects
- designing function object adapters
- container adapters
- priority_queues and heaps
- Iterator Design
- the iterator base class and iterator traits
- review: class template specialization and partial
specialization
- iterators and const_iterators
- accessing iterator information in generic algorithms
- versioning of generic algorithms based on iterator class
- reverse iterators and iterator adapters
- insert iterators, adapters, and helpers
- raw storage iterators, adapters, and helpers
- designing new iterators
- Container Design
- containers vs. STL containers
- STL container requirements
- design of a simple STL container
- design of a more complex STL container
- containers, iterators, and const_iterators
- basic STL components
- Allocator Design
- containers and memory management
- allocators and the standard allocator
- allocator portability problems
- container use of allocators
- design of a special-purpose allocator
- allocator hacking techniques