Articles & Books

C++20 span tutorial--Paul Silisteanu

All you need to know.

C++20 span tutorial

by Paul Silisteanu

From the article:

According to the latest C++20 draft, a span is a non-owning view over a contiguous sequence of objects. In other words, a std::span is, in essence, a pointer, length pair that gives the user a view into a contiguous sequence of elements. The elements of a span can be, for example, stored in one of the standard library sequential containers (like std::array, std::vector), in a built-in C-style array or in a memory buffer...

C++ 20: The Core Language--Rainer Grimm

Many changes for the better.

C++ 20: The Core Language

by Rainer Grimm

From the article:

My last post C++20: The Big Four started with an overview of concepts, ranges, coroutines, and modules. Of course, C++20 has more to offer. Today, let's continue my overview of the core language...

A Universal Async Abstraction for C++ -- Corentin Jabot

Executors - of which P0443R11 is one of the latest iterations - is poised to be the most fundamental library addition to C++23.

A Universal Async Abstraction for C++

By Corentin Jabot

From the article:

What is it about?

It is first and foremost a quest to find the most basic building blocks on top of which one could build asynchronous, concurrent and parallel code, whether it be on a small chip or a supercomputer with thousands of CPUs and GPUs.

This is not an easy task and has kept many experts and many companies busy for many years.

Access tuple-like container by type to return an index -- Krzysztof Ostrowski

How would you look for an item in a tuple by the item's type, and return the item's index within that tuple?

Access tuple-like container by type to return an index

by Krzysztof Ostrowski

From the article:

Presentation of a technique that composes an application of a lazy fold expression, and an idea of type embellishment that introduces an implicit context in which the current tuple element is embedded.

C/C++ Include Guidelines -- Thomas Young

Good practices for setting up include files are key to keeping large code-bases manageable, in pre-modules C++, and this article presents 15 rules to keep you on the right track.

C/C++ Include Guidelines

by Thomas Young

From the article:

The rules listed here are relatively mechanical, by which I mean that these are things that can be applied locally to individual bits of source code, without strokes of genius or flashes of inspiration, but with the possibility to nevertheless significantly improve code organisation, which is useful particularly in the case of large legacy code bases.

How to Merge Consecutive Elements in a C++ Collection--Jonathan Boccara

Simple and sweet.

How to Merge Consecutive Elements in a C++ Collection

by Jonathan Boccara

From the article:

Merging identical consecutive elements in a collection is a recurring need, in C++ or elsewhere in programming.

For example, we could want to aggregate a collection of hourly results into a collection of daily results: all the results of each day get aggregated into one for that day. In this case, being “identical” means being on the same day, and “aggregating” means taking two results with a common date, and creating a result at this date and with the sum of their amounts...