Articles & Books

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.

Modernizing your code with C++20 -- Phil Nash

C++20 is here! In fact, as we head towards 2022, it’s been here a while. It may surprise some, but we’re only a few months from a freeze on new proposals for C++23! But let’s not get ahead of ourselves. C++20 is a big release - at least the biggest since C++11 - some have said it's the biggest since the first standard in 1998!

Modernizing your code with C++20

by Phil Nash

From the article:

Another possible surprise is that support for C++20 is currently better in GCC and MSVC++ than in Clang. Nonetheless, significant chunks of the new language and library features are widely available across the three major compilers, already. Many of them, including some less well known features, are there to make common things safer and easier. So we’ve been hard at work implementing analyzer rules to help us all take full advantage of the latest incarnation of “Modern C++”. This is just the start, but we already have 28 C++20-specific rules in the latest releases of all our products (with many more in development).

Let’s take a peek at some of them.

Conditional Members--Barry Revzin

Did you feel the need?

Conditional Members

by Barry Revzin

From the article:

I’d previously written a post about if constexpr (and how it’s not broken). I argued in that post how, broadly speaking, C++20 gives you the tools to solve the problems you want, even if they work a bit differently to D’s static if (with one notable exception, which this post greatly expands on). Now, over the past couple years, I’ve been working on a project that really is a deep dive into what Andrei calls “Design by Introspection.” This approach (for lack of a better definition), relies on conditioning functionality based on template parameters...