Effective Modern C++

C++ Training for Programmers by Scott Meyers

Presented by: Leor Zolman

Truly understanding C++11 and C++14 requires more than just familiarizing yourself with auto type declarations, move semantics, lambda expressions, concurrency support, etc. You also need to learn how to use those features effectively so that your software is correct, efficient, maintainable, and portable. That's where this seminar comes in. It describes how to write truly great software using C++11 and C++14 — i.e. using modern C++.

This course is based on Scott's best-selling Effective Modern C++.

Course Highlights

Participants will gain:

  • Familiarity with how best practices in "old" C++ programming (i.e., C++98) change for modern C++.
  • Awareness of the often-subtle performance implications of modern C++ features and techniques.
  • An understanding of the relationships among std::move, std::forward, rvalue references, and universal references.
  • Techniques for writing clear, correct, effective lambda expressions.
  • Insights into the pros and cons of braced initialization, noexcept specifications, perfect forwarding, and smart pointer make functions.

Who Should Attend

Systems designers, programmers, and technical managers involved in the design, implementation, and maintenance of libraries and applications using C++11 and C++14. Participants should be familiar with the fundamental concepts introduced by C++11 (e.g., move semantics, multithreading, lambda expressions, smart pointers, etc.), but expertise is not required.

One way to acquire the appropriate background is through Leor Zolman's introductory course, Moving Up to Modern C++: An Introduction to C++11/14/17 for C++ Programmers.

Detailed Topic Outline

  • Preliminaries
    • Distinguish lvalues and rvalues.
    • Understand type deduction.
      • (auto-related) template type deduction
      • auto type deduction
      • Observing deduced types
      • decltype type deduction
      • Function return type deduction
    • Understand std::move and std::forward.
  • Moving to Modern C++
    • Prefer auto to explicit types when declaring objects.
    • Remember that auto + { expr }std::initializer_list.
    • Distinguish () and {} when creating objects.
    • Prefer nullptr to 0 and NULL.
    • Prefer scoped enums to unscoped enums.
    • Prefer deleted functions to private undefined ones.
    • Declare overriding functions override.
    • Declare functions noexcept if they won’t emit exceptions.
    • Use constexpr whenever possible.
    • Make const member functions thread-safe.
  • Smart Pointers
    • Use std::unique_ptr for exclusive-ownership resource management.
    • Use std::shared_ptr for shared-ownership resource management.
    • Prefer std::make_unique and std::make_shared to direct use of new.
  • Rvalue References, Move Semantics, and Perfect Forwarding
    • Distinguish universal references from rvalue references.
    • Pass and return rvalue references via std::move, universal references via std::forward.
    • Avoid overloading on universal references.
    • Understand reference collapsing.
    • Assume that move operations are not present, not cheap, and not used.
    • Familiarize yourself with perfect forwarding failure cases.
  • Lambda Expressions
    • Avoid default capture modes.
    • Use init capture to move objects into closures.
    • Prefer lambdas to std::bind.
  • The Concurrency API
    • Make std::threads unjoinable on all paths.
    • Use std::launch::async with std::async if asynchronicity is essential.
    • Be aware of varying thread handle destructor behavior.
    • Create tasks, not threads.
    • Consider void futures for one-shot event communication.
  • Miscellaneous
    • Consider emplacement instead of insertion.
  • Resources for Further Information

Lecture and question/answer. There are no hands-on exercises, but participants are welcome — encouraged! — to bring computers to experiment with the material as it is presented.

4-5 full days (six lecture hours per day.)

Contact Us | Pricing | Copyright © 2024 by Leor Zolman | Links