experimental

Generators and the Sweet Syntactic Sugar of Coroutines--Adi Shavit

A very detailed and interesting article, a must read!

Generators and the Sweet Syntactic Sugar of Coroutines

by Adi Shavit

From the article:

“Coroutines make it trivial to define your own ranges.”
— Eric Niebler, Lead author of the C++ Ranges proposal (edited for drama)

Hmmm… is that so?
But wait, what are coroutines?

From Boost.Coroutine2: A coroutine (coined by Melvin Conway in 1958!) is a function that can suspend execution to be resumed later. It allows suspending and resuming execution at certain locations and preserves the local state of execution and allows re-entering the subroutine more than once. In contrast to threads, which are pre-emptive, coroutine switches are cooperative: the programmer controls when a switch will happen. The kernel is not involved in the coroutine switches.

This sounds just like what we want!

C++ coroutines: Getting started with awaitable objects--Raymond Chen

So many possibilities!

C++ coroutines: Getting started with awaitable objects

by Raymond Chen

From the article:

Coroutines were added to C++20, and Lewis Baker has a nice introduction to them.

  • Coroutine theory.
  • Understanding operator co_await.
  • Understanding the promise type.

But I’m going to write another one, taking a more practical approach: The least you need to know to accomplish various coroutine tasks...

C++20: Concepts, the Details--Rainer Grimm

The series continue.

C++20: Concepts, the Details

by Rainer Grimm

From the article:

In my last post C++20: Two Extremes and the Rescue with Concepts, I gave the first motivation for concepts. Concepts put semantic constraints on template parameters. Today, I present different use-cases for concepts in a compact form...

Named Template Arguments--Barry Revzin

It's coming!

Named Template Arguments

by Barry Revzin

From the article:

C++, unlike many other programming languages, doesn’t have named function parameters or named function arguments. I hope it will someday, it’s a language feature that I find has large benefits for readability. Until then, in C++20, we actually have the ability to do a decent approximation not only of named function arguments but also named template arguments...