The Standard Library from Scratch [2018 class archive]

“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 29th and 30th, 2018 (immediately following 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++17 lambdas from the ground up; as contrasted with std::function
  • Classical polymorphism: virtual functions, vtables and vpointers
  • Type erasure: std::function, std::packaged_task, and std::any
  • Small object optimization in std::string¬†and std::function
  • The iterator hierarchy: implementing container iterators and iterator adaptors
  • Allocators and what it means to be ‚Äúallocator-aware‚ÄĚ
  • Comparators, std::less, and heterogeneous perfect forwarding
  • Hashing and std::hash
  • Specializing behavior via SFINAE and tag dispatch: vector<bool> and future<T&>
  • Complex metaprogramming: std::tuple and tuple_cat, std::variant and visit
  • libcxxabi exception handling and std::exception_ptr
  • std::atomic, std::mutex, std::condition_variable, and¬†std::call_once
  • Promises and futures¬†from scratch
  • 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 is the author of Mastering the C++17 STL (2017). He organizes a weekly C++ meetup in San Francisco and speaks regularly on C++ topics.