O'Reilly logo
live online training icon Live Online training

What's new in C++

Comprehensive overview of C++17’s killer features

Topic: Programming
Vittorio Romeo

This course will cover all the most important additions in C++17, the latest C++ standard. Both the core language and the library have been extended with new features that significantly reduce the likelihood of bugs, improve readability and maintainability of code, and enable new powerful programming paradigms.

Through presentations, quizzes, and real-life usage examples, you will learn about the great value C++17 brings to the table and you’ll be able to start taking advantage of it in your projects immediately.

What you'll learn-and how you can apply it

By the end of this live, hands-on, online course, you’ll understand:

  • C++17 features and the reasons why they were added to the language.
  • How to immediately make your code safer and less prone to bugs.
  • Avoiding security issues and undefined behavior with [[nodiscard]].
  • Avoiding performance and security issues with [[fallthrough]].
  • Preventing invalid states from being represented thanks to std::variant and std::optional.
  • How to reduce boilerplate or verbose patterns which are present in most codebases.
  • New code generation features such as “fold expressions”.
  • How C++17 completely eliminates copies and moves of your objects in many cases.
  • How to make your code more pythonic and functional, thanks to “structured bindings”.
  • How to completely eliminate arcane SFINAE techniques thanks to constexpr if.
  • Fixes to surprising behaviors in the language, such as auto curly brace deduction.

And you’ll be able to:

  • Immediately and gradually apply C++17 features in an existing codebase to improve safety and maintainability.
  • Design new components with new powerful patterns that help model real-world scenarios minimizing complexity.
  • Improve compilation times and readability by replacing template metaprogramming with simpler and more powerful constructs.

This training course is for you because...

  • You are a C++11/14 developer who wants to migrate towards C++17
  • You want to improve the safety and readability of an existing C++ codebase thanks to C++17 features
  • You want to enhance your team’s development experience thanks to C++17 quality-of-life improvements

Prerequisites

  • Comfort with C++11, such as familiarity with move semantics, smart pointers, and lambda expressions
  • Basic knowledge of C++14

Recommended preparation:

About your instructor

  • Vittorio Romeo (B.Sc., Computer Science, 2016) is a Senior Software Engineer at Bloomberg, working on mission-critical C++ middleware and delivering Modern C++ training to hundreds of fellow employees. He began programming at the age of 8 and quickly fell in love with C++. Vittorio has created several open-source C++ libraries and games, has published many video courses and tutorials, and actively participates in the ISO C++ standardization process. He is an active member of the C++ community with an ardent desire to share his knowledge and learn from others: He presented more than 20 times at international C++ conferences (including CppCon, C++Now, ++it, ACCU, C++ On Sea, C++ Russia, and Meeting C++), covering topics from game development to template metaprogramming. Vittorio maintains a website with advanced C++ articles and a YouTube channel featuring well received modern C++11/14 tutorials. He is active on StackOverflow, taking great care in answering interesting C++ questions (75k+ reputation). When he is not writing code, Vittorio enjoys weightlifting and fitness-related activities as well as computer gaming and sci-fi movies.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Quality of life improvements (50 minutes)

  • Presentation: How new features improve productivity and reduce annoyances - 30 minutes
  • Discussion: How could the shown features improve your current projects? - 5 minutes
  • Exercise: Reduce boilerplate and improve readability in an existing code snippet - 10 minutes
  • Q&A
  • Break: 5 minutes

Bug prevention with C++17 attributes (40 minutes)

  • Presentation: Common bugs and how new attributes can prevent them - 20 minutes
  • Discussion: Have you ever encountered any of these bugs? - 5 minutes
  • Exercise: Spot the bugs in an existing code snippet and apply attributes - 10 minutes
  • Q&A
  • Break: 5 minutes

Algebraic data types (50 minutes)

  • Presentation: Concept of algebraic data types and their implementation in C++17 - 30 minutes
  • Discussion: Polymorphism vs algebraic data types - 5 minutes
  • Exercise: Implement a message protocol using variants - 10 minutes
  • Q&A
  • Break: 5 minutes

Structured bindings (40 minutes)

  • Presentation: How structured bindings make C++ code more pythonic - 20 minutes
  • Discussion: How C++ is becoming more and more terse - 5 minutes
  • Exercise: Create structured bindings for a custom class - 10 minutes
  • Q&A
  • Break: 5 minutes

C++17 metaprogramming (50 minutes)

  • Presentation: Metaprogramming - why and how with C++17 features - 30 minutes
  • Discussion: Use cases for metaprogramming in your projects - 5 minutes
  • Exercise: Implement compile-time loops with fold expressions - 10 minutes
  • Q&A