Entries by Rainer Grimm

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” […]

An Advanced Priority Scheduler for Coroutines

Today, I use the straightforward scheduler from the post “A Priority Scheduler for Coroutines” and improve its priority handling. This is the fourth post in my miniseries about schedulers for C++ coroutines. The first two posts were guest posts by Dian-Lun Lin: Dian-Lun’s schedulers were based on the container adaptor std::stack and std::queue. The std::stack […]

A Priority Scheduler for Coroutines

In this post, I will extend the straightforward scheduler from Dian-Lun with priorities. This is the third post in my mini-series about schedulers for C++ coroutines. The first two posts were guest posts by Dian-Lun Lin: Dian-Lun’s schedulers were based on the container adaptor std::stack and std::queue. The std::stack schedules its tasks according to its […]

Coroutines: A Scheduler for Tasks by Dian-Lun Lin

The last post “A Concise Introduction to Coroutines by Dian-Lun Lin” provide the theory. Today, Dian-Lun presents his single-threaded scheduler for C++ coroutines. This post assumes you are familiar with the previous post “A Concise Introduction to Coroutines by Dian-Lun Lin“. A Single-threaded Scheduler for C++ Coroutines In this section, I implement a single-threaded scheduler […]

Thank You for Your Support: 1/n

After I wrote about my ALS illness in my post “My very Serious Progressive Nerve Condition“, I decided to make all 2 – 3 weeks a short update about my condition. I want to do this for a few reasons. I recognized that the most important part of fighting such a depressing illness is to […]