The Standard Library from Scratch

“The Standard Library from Scratch” is a two-day training course with programming exercises taught by Arthur O’Dwyer. It is offered at the Meydenbauer Conference Center from 9AM to 5PM on Saturday and Sunday, September 23rd and 24th (immediately prior to the conference). Lunch is included.

Course Description

Join Arthur O’Dwyer on a deep dive into the innards of the standard library. We’ll implement a significant fraction of the standard library in two days, by building high-level components on top of lower-level ones. As we go, we’ll touch on just about every aspect of modern C++ programming, including value semantics, exception safety, the C++11 multi-threaded memory model, and several “standard” API design patterns.

This course is ideal for anyone who worries about the potentially hidden performance costs of “modern C++”, anyone who needs to implement a bulletproof C++ API in the style of the standard library, or for anyone who enjoys digging deep into the internals of complex systems.

Prerequisites

Students are expected to have a good working knowledge of C++11. A working knowledge of classes, virtual functions, templates, exception-handling, C++11 lambdas, and move semantics will be assumed. Knowledge of C++14 or template metaprogramming is not required. The class will include short exercises presented via the online compiler at wandbox.org. Please bring a computer with a Web browser and/or a C++14 compiler installed.

Course Topics

  • C++14 lambdas from the ground up; as contrasted with std::function
  • Classical polymorphism: virtual functions, vtables and vpointers
  • Small object optimizations: std::string and std::function
  • Sequence containers and node-based containers
  • Specializing behavior via SFINAE and tag dispatch: vector<bool> and future<T&>
  • The iterator hierarchy; implementing container iterators and iterator adaptors
  • Comparators, std::less, and heterogeneous perfect forwarding
  • Allocators and what it means to be “allocator-aware”
  • Hashing and std::hash
  • libcxxabi exception handling from the ground up: std::exception_ptr
  • The C++ memory model from the ground up: std::atomic_flag, std::mutex, std::condition_variable
  • Atomic high-level operations: std::call_once, std::shared_ptr, and std::promise
  • Type erasure: std::function, std::packaged_task, and std::any
  • Complex metaprogramming: std::tuple, std::variant, and std::visit
  • Why certain functions are noexcept and others aren’t
  • What it means for special member functions to be implicitly defined, defaulted, deleted, and/or trivial

Course Instructor

Arthur_ODwyer

Arthur O’Dwyer worked for many years at Green Hills Software, making the world’s most optimizing C and C++ compilers. He organizes the San Francisco C++ meetup and presents regularly on C++ topics.