Class - Modern C++: When Efficiency Matters


Course Description

You want to learn how to write efficient C++ because you

  • care for the speed of your product?
  • like to write robust code?
  • write code for a constrained device?

Then consider this class. You will learn about various features of modern C++, how they work, where to use them, and how they translate to code. With that knowledge, you understand what each feature brings you and what it costs. You will learn how to write less code and get the same result, as well as how to control the binary footprint and the speed of your binary. You will learn this with exercises and live demos in C++ Insights and Compiler Explorer.

Aside from controlling the resulting code, we will also look to implement things with less code. This helps to save human resources when it comes to maintenance and debugging.

Course Outline

  • Compile-time vs. run-time
  • Write robust code
    • Type-deduction surprises
    • Range-based for-loops
    • What is a std::initializer_list
    • Narrow the variable scope: if / switch with initialization
  • Write less code
    • Constructor inheritance
    • Avoid uninitialized members with in-class member initialization
  • Reduce the binary footprint of your binary
    • noexcept
    • Guidelines for efficient use of templates
    • Save space with no_unique_address
  • Write fast code
    • Reduce the number of copies with guaranteed copy elision
    • Move-semantics
  • Lambdas
    • Captures: Understand what will be captured
    • Generic as well as lambdas with a template-head (a preview into C++20)
  • How things work
    • Structured bindings
    • How a local non-trivial static variable works
    • Understand the costs of the abstraction: shared-/unique-ptr
  • Using the STL efficiently

Included in this course are

  • A handout as color PDF, which includes all references and an acronyms list;
  • The source code for the exercises as well as sample solutions for all exercises as a zip-file;
  • Certificate of attendance;
  • A complimentary copy one of my books

Keep me informed

These fields are required.