Articles & Books

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...

C++20: Heterogeneous Lookup in (Un)ordered Containers--Bartlomiej Filipek

Did you know?

C++20: Heterogeneous Lookup in (Un)ordered Containers

by Bartlomiej Filipek

From the article:

Would you like to gain 20…35 or even 50% speed improvements when searching in associative containers? In this blog post, we’ll explore a technique called “heterogenous access” that offers such impressive speedups. We’ll explore ordered containers, and the support for unordered collections added recently in C++20...