C++: A New Language Starting In 2011 (2022-10-11 - 2022-10-13)

Metadata

Course Preparation

We will be doing a number of exercises and trainer livehacking sessions. All this is done starting from a skeleton Github project.

Please try and get the skeleton project, create an environment that works for you, and test-build that project.

Work Environment

I suggest you use the Windows Subsystem For Linux (WSL2) (Microsoft documentation here). This sets up a virtualized Ubuntu insode Windows, together with all interoperability wazoo.

It is also possible to setup a Linux-like environment on native Windows, using the following emulation layers

  • Cygwin

  • MinGW (known to have problems when it comes to threading)

Skeleton Project

The project uses CMake and googletest. Ideal work anvironment is Linux(-like). If you have such an environment, then the steps to build the project are,

  • Clone and massage the project source

    $ pwd
    $ /home/jfasch/src       # <--- your mileage will vary
    $ git clone https://github.com/jfasch/2022-10-11.git
    $ cd 2022-10-11/
    $ git submodule init
    $ git submodule update
    
  • Create build directory, and chdir there

    $ mkdir /tmp/2022-10-11-build
    $ cd /tmp/2022-10-11-build
    
  • Use CMake to create makefiles

    $ pwd
    /tmp/2022-10-11-build
    $ cmake /home/jfasch/src/2022-10-11
    
  • Build

    $ pwd
    /tmp/2022-10-11-build
    $ make
    

Introduction

Pythonicity (Thank You: Readablility and Writability)

Range Based for Loops

Tuple Unpacking (err, Structured Binding)

Duck Typing (err, auto) Without A Duck

Exercise

Things That Simply Deserved Fixing Since Ages

Brace Initialization

From Brace Initialization (Uniform Initialization)

New OO keywords: override, final, default, delete

Strongly Typed enum

Delegating Constructor

nullptr

Smart Pointers

From Smart Pointers (std::unique_ptr, std::shared_ptr):

Moving, “RValue References”, And Perfect Forwarding

From Move Semantics, Rvalue References

Perfect forwarding ain’t moving:

Functions (std::bind<>, std::function<>, Lambdas)

From Functions, Functions:

From Lambda

Multithreading

From Multithreading:

News in C++20 (2023-06-13)

Coroutines and C++23 Generators

From Coroutines

Ranges And Views

From Ranges

Concepts

From Concepts