Entries by Rainer Grimm

Projections with Ranges

The algorithms of the ranges library are lazy, can work directly on the container, and can easily be composed. But they have more to offer: projections. A projection is a mapping of a set into a subset. Let me show you in this post what that means:

The Ranges Library in C++20: More Details

Working with the Standard Template Library (STL) is much more comfortable and powerful thanks to the ranges library. The algorithms of the ranges library are lazy, can work directly on the container, and can quickly be composed. But there is more to it:

Define Concepts

There are two ways to define a concept: You can combine existing concepts and compile-time predicates, or you can apply a requires expression in four different ways.

Type Erasure

Type erasure based on templates is a pretty sophisticated technique. It bridges dynamic polymorphism (object orientation) with static polymorphism (templates).