Articles & Books

Design and evolution of constexpr in C++

constexpr is one of the magic keywords in modern C++. You can use it to create code, that is then executed before the compilation process ends. This is the absolute upper limit for software performance.

Design and evolution of constexpr in C++

by Evgeny Shulgin

From the article:

The authors suffered greatly from the inability to use STL containers and wrote the std::vector and std::map analogues. Inside, these analogues have std::array that can work in constexpr. Proposal [P0784] Standard containers and constexpr studies the possibility of inputting STL containers in constexpr evaluations. Note. It's important to know what an allocator is. STL containers work with memory through it. What kind of an allocator — is specified through the tempte argument. If you want to get into the topic, read this article.

Little C++ Standard Library Utility: std::align -- Lesley Lai

An introduction of std::align with the arena allocator as motivational example

Little C++ Standard Library Utility: std::align

by Lesley Lai

From the article:

Recently, I learned about std::align, which is one of the lesser-known functions in the C++ standard library because of its limited use cases. Since it is hard to describe without a specific use case, I will use a simple implementation of an arena allocator as a motivational example.

C++20 Concepts: Part 5 (Advanced use cases)--Gajendra Gulgulia

The series continue.

C++20 Concepts: Part 5 (Advanced use cases)

by Gajendra Gulgulia

From the article:

In this article, I’ll explain and demonstrate how to define concepts that constrain multiple template parameters and more importantly how to use them in a generic function. As promised in the part 3 of the series, I’ll explain this using a function comparing for equality of two different types T and U

The Evolutions of Lambdas in C++14, C++17 and C++20--Jonathan Boccara

Are you using them?

The Evolutions of Lambdas in C++14, C++17 and C++20

by Jonathan Boccara

From the article:

Lambdas are one of the most popular features of Modern C++. Since their introduction in C++11, they’ve become ubiquitous in C++ code.

But since their appearance in C++11, they have evolved and gained significant features. Some of those features help write more expressive code, and since using lambdas is so common now, it is worth it to spend time learning what we can do with them.

Our goal here is to cover the major evolutions of lambdas, but not all the little details. A comprehensive coverage of lambdas would be more suited for a book than an article. If you want to dig more, I recommend Bartek’s book C++ Lambda Story, that will tell you everything.

The general evolution of lambdas is to give them able the capabilities of function objects manually defined.

This articles assumes you know the basics of lambdas in C++11. Let’s take it from C++14...

C++20 Concepts: part 4--Gajendra Gulgulia

The series continue.

C++20 Concepts: part 4

by Gajendra Gulgulia

From the article:

In this issue of the concepts tutorial, I’ll discuss in detail about abbreviated function template syntax , constraining auto with abbreviated function template syntax , constraining deduced return type, i.e. constraining the auto return type with concepts...

C++ Reflection TS: A First Look -- Clément Pirelli

The Reflection TS was blessed with an example implementation recently, available on Compiler Explorer. Clément Pirelli gave it a spin and wrote a small post about what he found.

C++ Reflection TS: A First Look

by Clément Pirelli

From the article:

In this post, I’ll explain the basic ideas of the specification, how to write a simple generic “enum to string” function and go into a bit more detail with a proof-of-concept serialization function.