Classic STL: Algorithms, Containers, Iterators

Classic STL: Algorithms, Containers, Iterators is a three-day online training course with programming exercises taught by Arthur O’Dwyer. It is offered online from 11AM to 5PM Eastern Time (EDT),  Monday September 21st through Wednesday September 23rd, 2020 (after the conference).

Course Description

With Ranges on the horizon, it’s more important than ever to have a solid grasp of classic C++ STL concepts: containers, iterators, and algorithms.

We’ll start with a refresher on C++ template syntax and an introduction to the fundamentals of generic programming with concepts. Next, we’ll look at the technical considerations that went into the Standard Template Library’s design, and how those considerations have shifted in the two decades since C++98.

After motivating the STL’s core concepts of non-owning iterators and half-open ranges, we’ll dive into the different kinds of iterators in the STL, and look at the mechanisms by which the STL distinguishes iterator capabilities and the kinds of optimizations that it can perform. We’ll also cover iterator adaptors such as move_iterator, insert_iterator, and ostream_iterator.

On Day 2, attendees will receive a guided tour of most of the STL’s generic algorithms, with particular attention paid to those algorithms that are useful in practice (std::partition, std::lower_bound, std::count, std::unique) and those with surprising or non-obvious behavior (for example, std::partial_sort versus std::nth_element). We’ll also cover all the standard containers and some of their lesser-known member functions, such as std::list::sort() and std::map::count(). We’ll present best practices for using the standard containers with user-defined comparators, hashers, and allocators.

While this course will focus mainly on classic STL idioms (updated for move semantics where applicable), we’ll take a little time on Day 3 to speculate about how these classic idioms might interact with upcoming C++20 features such as Ranges and Coroutines, and to discuss where C++17 string_view fits into the STL ecosystem.

Attendees will practice their STL skills with a series of downloadable hands-on lab exercises, using either Wandbox or their own C++14-or-later development environment.


Attendees should have basic to intermediate knowledge of C++11, including at least one or two years of programming experience. A basic understanding of pointers, templates, data structures, and C++11 move semantics will be assumed.

Course Topics

  • Intro to C++ Templates
  • Intro to Generic Programming, the STL’s assumptions, and the Iterator Model
  • The iterator hierarchy
  • Special iterator types and adaptors
  • Defining your own iterator type
  • String and string_view
  • All the Containers, and best practices for comparators and hashers
  • All the Algorithms: random-access invariants (partitioning, sortedness, and heapness)
  • All the Algorithms: counting, filtering, and permuting
  • list.sort(), std::erase_if, and other unusual APIs
  • No Raw Loops?
  • Interactions with Ranges and Coroutines

Register Here

Course Instructor


Arthur O’Dwyer is a speaker, trainer, and blogger on modern C++ topics. He has spoken at every CppCon since its inception in 2014, and is the chair of the Back to Basics track that debuted at CppCon 2019. Arthur is the author of Mastering the C++17 STL (2017). He lives and works in New York.