Articles & Books

std::any - comparison with void* and motivating examples -- Hitesh Kumar

An introduction to std::any and comparison with void*.

std::any - comparison with void* and motivating examples

by Hitesh Kumar

From the article:

std::any is often compared with void* because the latter has been the de-facto choice for storing or passing the arbitrary objects in C++ since the outset. std::any is not a replacement of void*, but it is a safer substitute for the boilerplate patterns built around void*. Nevertheless, a comparison between the two is required for a better understanding of std::any.

Feature Testing with C++20--Rainer Grimm

Use all that you can.

Feature Testing with C++20

by Rainer Grimm

From the article:

When your program's compilation broke with a brand-new C++20 feature, you often end with a few questions: Did I something wrong? Did I found a compiler bug? Does my compiler not yet support this feature? Thanks to the feature testing in C++20, the last question is easy to answer...

Under the Covers of C++ Lambdas: Captures, Captures, Captures--Andreas Fertig

Lambdas.

Under the Covers of C++ Lambdas: Captures, Captures, Captures

by Andreas Fertig

From the article:

Lambda Capturing syntax allows us to quickly “wrap” a variable from the outside scope and then use it in the lambda body. We also know that under the hood the compiler translates lambda into a closure type… but what happens to those captured variables? Are they translated to public data members or private? See the newest guest post from Andreas to understand this tricky problem...

Capture *this in lambda expression: Timeline of change -- Hitesh Kumar

The current object (*this) capture in a lambda expression has gone through some changes since C++11.

Capture *this in lambda expression: Timeline of change

by Hitesh Kumar

From the article:

A lambda defined inside a non-static member function can directly access the members of the current object (or its copy) via an appropriate capture clause. But how the current object can be captured has gone through some changes since C++11.