C++ - Overview Of New Language Features (Around C++20) (2025-07-02 - 2025-07-03)#
Day 1#
Smart Pointers#
Move Semantics, Rvalue References is a complex topic to
explain. A smart pointer overview is a good thing to have anyway. Lets
start with that, and - through std::unique_ptr
- get insight in what
moving is from a user’s point of view.
From Smart Pointers: std::unique_ptr, std::shared_ptr (And std::weak_ptr)
Rule Of Five (Three, Zero), And Move Semantics#
Another good thing to have is a rule to fight against C++’s shortcomings. This expains how to write copyable and movable types, likewise.
Perfect Forwarding, only to show that this is a different concept but looks syntactically much like moving.
C++ Executed At Compile Time (The constexpr
Engine)#
That was a bit Involved - Compiler Explorer, looking into objects with nm
, and all
that. Finally the conclusion was that template metaprogramming has
become obsolete 😘.
From The constexpr Engine
std::filesystem
#
There was some time left on that day, and std::filesystem
is just
small enough to fill the gap.
Day 2#
Multithreading, Memory Model#
C++20 brings Atomic Shared Pointer - a review of threading, race conditions, atomics, and the C++ memory model is in order.
From Multithreading, C++ Memory Model
The C++ Memory Model. This briefly shows what a race condition is, and gives mutex examples.
std::span
, Ranges, Views, Concepts#
An outlook how C++20 redefines (again) the way C++ programs are written. The guys liked it, and started to use ranges in their code as soon as we took the next break.
All The Rest#
Looked over cppreference.com’s docs on std::unordered_set and std::unordered_map. Discussed difference between hash tables and red-black trees.
Execution Policies And Parallel Algorithms (Incomplete Draft). I hadn’t gotten that to work, so only a frontal presentation of how it should work was given.
The Spaceship Operator <=> (And Comparison In General). Presented frontally.
Explicit Object Member Functions (A.k.a Deducing this). Presented frontally, trying to understand what this particular feature brings (again, redefine the way C++ is written 😴)
std::any, std::variant, std::optional. Frontally showing the API, discussing usage scenarios.
Coroutines? Generators? (Coroutines). Material is a little outdated and not up to date with C++20. I had gotten a Python style generator to work with what was there (general coroutines). Discussed what that was, and the difference between it and multithreading.