Entries by Rainer Grimm

The Formatting Library in C++20

Today, I will start a series about the formatting library in C++20. The series is based on my C++20 book. Although Peter Gottschling wrote two great blog posts about the formatting library in C++20 (“std::format in C++20“, “C++20: Extend std::format for User-Defined Types“, I will write about the formatting library again. The reason is simple: […]

My ALS Journey: 4/n

In the last three weeks, a lot happened. I was in the ALS-Ambulanz in Ulm and started a money-raising campaign. Business as Usual After the Christmas break, business as usual is back. I am giving a 3-day Python class this week, teaching the basics and object orientation with Python. I have a long Python history […]

std::span in C++20: More Details

A std::span represents an object that refers to a contiguous sequence of objects. Today, I want to write about its not-so-obvious features. A std::span, sometimes also called a view, is never an owner. This contiguous memory can be a plain array, a pointer with a size, a std::array, a std::vector, or a std::string. A typical […]

Our Money-Raising Campaign for ALS Research

Get my 3-book bundle Modern C++ Collection for half the price ($70 -> $35). I will donate the money to the ALS research. Donation sum so far: $5800. Let me start with the facts. Research around ALS is Heavily Underfunded Here is a statement from the ALS-Ambulanz, translated into English: ALS is one of the […]

The autogenerated Equality Operator

You can define the three-way comparison operator or request it from the compiler with =default. But do you know that you can also define or request the equality operator in C++20? Before I dive into the autogenerated equality operator, I’d like to refresh your knowledge about the three-way comparison operator. The Three-Way Comparison Operator You […]

My ALS Journey: 3/n

Here is what happened in the last three weeks. Let me start with a very thoughtful Christmas present. Brief Answers to the Big Questions by Stephen Hawking My son Marius gave me the Christmas present “Brief Answers to the Big Questions” by Stephen Hawking. I’m very curious to read it. You may know it. Stephen […]

The Second Edition of my C++20 Book on Amazon

I have given many C++20 classes in the last two years and improved my C++20 knowledge. Consequentially, I updated my C++20 book. This update includes restructured chapters, more detailed information, and additional examples. The book now has almost 700 pages and more than 200 examples. This issue is the final one. I’m done and will […]

A Coroutines-Based Single Consumer – Single Producer Workflow by Ljubic Damir

I’m happy to present in this guest post by Ljubic Damir a typical use-case for coroutines: a producer – consumer workflow. Although this producer-consumer workflow is challenging, it is a nice starting point for your coroutine experiments. Intro Coroutines provide a more intuitive and structured way of writing asynchronous code by allowing you to write […]

A Bug in the Priority Scheduler for Coroutines

In my last two posts, I presented priority schedulers for coroutines. The schedulers had a bug. First of all, here is the erroneous scheduler. // priority_queueSchedulerPriority.cpp #include <concepts> #include <coroutine> #include <functional> #include <iostream> #include <queue> #include <utility> struct Task { struct promise_type { std::suspend_always initial_suspend() noexcept { return {}; } std::suspend_always final_suspend() noexcept { […]

My ALS Journey: 2/n

As promised, here is what happened in the last three weeks. Let me start with the more pleasing things. Classes, a Workshop, and a Presentation In the last two weeks, I gave three-days online classes and did my worldwide C++ mentoring on Friday. This week was special. On Monday at the “Embedded Software Engineering Kongress” […]