Modern C++ Programming

Course objectives

Delegates will learn:

  • new C++ features such as nullptr, auto and decltype deduction mechanisms, range-based for loop, strongly typed enums (scoped enums), and uniform initialization syntax
  • implementation of move semantics for classes and the perfect forwarding mechanism
  • lambda expressions and their practical application
  • mechanisms of secure memory management with smart pointers
  • new features in templates: variadic templates and fold expressions
  • new components in the Standard Library, such as std::tuple, std::optional and std::variant
  • how to call functions and create data structures at the compilation stage

Course syllabus

Core language features

  • New basic types in C++11/17
  • Raw strings
  • nullptr keyword
  • Type deduction in modern C++
    • auto
    • decltype
  • Functions and trailing return type
  • Scoped enumerations
  • if and switch with initializers
  • Range-based-for loops
  • Uniform initialization syntax
  • Initializers list
  • Static inline class members
  • New attributes: [[nodiscard]], [[maybe_unsued]], etc.

New features in C++ classes

• Special member functions • Default initialization of non-static members • Delegating and inheriting of constructors • Overriding virtual methods – override • Blocking inheritance and overriding using final • Explicit conversion functions

Move semantics

  • l-value vs. r-value
  • r-value references – T&&
  • Implementing "move semantics" for types
  • Using std::move()
  • Perfect forwarding and universal references
  • Copy Elision and Return Value Optimisation (RVO)
  • noexcept keyword

Lambda expressions

  • Callables
  • Lambda expressions and closures
    • Capturing variables – closures
  • Lambdas in STL algorithms
  • Passing lambdas in variables - auto vs. std::function
    • Queues
    • Callbacks

Memory management in modern C++

  • RAII idiom (Resource Aquisition Is Initialization)
  • Smart pointers
    • std::unique_ptr
    • std::shared_ptr
    • std::weak_ptr
  • Custom dealocators

Constant expressions in C++

  • constexpr expressions
  • constexpr functions
  • Using constant expressions for generating data structures at compile time
    • constexpr if

Templates

  • Type Traits library
  • Variadic templates
  • Fold expressions
  • Class Template Argument Deduction - CTAD

Standard Template Library

  • std::byte
  • std::array - convenient wrapper for native arrays
  • Hash containers
  • std::function
  • Tuples – std::tuple
    • Structured bindings in C++17
    • Use cases
  • std::string_view
  • std::optional
  • Dynamic objects - std::any
  • std::variant and visitation mechanism

Prerequisites

Attendance of our Programming in C++ course or equivalent experience with C++

Course duration

5 days, 8 class hours each
On-site course quote

In-house training course.

Run at your company premises.

Get a quote
On-line course quote

In-house training course.

Delivered live in a virtual classroom.

Get a quote
Upcoming public courses

No scheduled dates available for this course?

Request a course