Programming with C++11 to C++17


Description

C++ has changed massively since 2011. There were three new language standards, 11, 14 and 17. A fourth is with C++ 20 already on the way.

The new elements often make it easier for us to write less and more correct code. With constexpr the language has a unique way to do things already at compile time. Our bonus: less RAM and ROM consumption as well as a time saving.

In this class, you will learn how the new standards help you to write faster and more robust code.

Content

After the long period without updates to C++ until 2011 the language has been continuously improved with new standards. This brings valuable new features to C++ which are interesting. Participants will learn how to use new language features such as constexpr to optimize code size or performance.

We start with new language elements like auto, override and the uniform initialization. With this knowledge, we continue to look into innovations such as constexpr. Of course, Lambdas are discussed as well, they are one of the long-missing elements.

To the delight of all enthusiastic template users we look at the innovation in C++11: variadic templates.

We also treat move semantics and analyze when it will bring us a profit. Here we talk about what should be considered in their use and in which situations the feature is disabled by the compiler.

Finally, we look at a few selected innovations in the STL. Very interesting for many C++ programmers here are the smart pointers. But also containers like std::tuple or std::vector are explained.

After the seminar, participants will have a clear understanding of what the new standards bring to them. You can consciously select features from the new language standards for a project and use it safely.

Topics Outline

  • Clean and modern C++ code
  • Uniform initialization:
    • Initialization with curly braces
    • std::initializer_list
  • New elements:
    • Type determination with auto and trailing return type
    • Range-based for-loops
    • Literal operator
    • class enum
    • nullptr
    • override
    • final
    • =default, =delete
    • In-class initialization
    • Inherited constructors
    • Structured bindings
  • Do things at compile time:
    • constexpr
    • static_assert
    • constexpr if
  • Lambdas
  • Move semantics:
    • Rvalue references
    • std::move
    • Prefect forwarding
    • The rule of 0/3/5
  • Template changes:
    • Variadic templates
    • Alias template with using
    • Fold expressions
    • Class Template Argument Deduction
  • Selected updates to the STL:
    • Smart pointer
    • std::array
    • std::tuple
    • Type-traits
    • Time under control with chrono
    • A look in the algorithm header