Visual Studio's Natvis Debugging Framework Tutorial

Last time in A Debugging Tip: Write Custom Visualizers in Visual Studio, I introduced the Visual Studio’s Natvis Framework and showed you a couple of samples. That article was just a basic introduction, and now it’s time to see more experiments. Learn From Existing Code First of all, we can examine existing code that is shipped with Visual Studio and see how it works.

READ MORE...

C++ at the end of 2020

While 2020 was a crazy and hard year we were fortunate - C++20 was accepted and published, and the work on new features continues. As usually every year, here’s my overview of the year: the standardization process, features, implementation, compilers, tools, books and more. Other Reports: 2020 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012.

READ MORE...

Why Not a Functor and Lambda Story Updates

I’m happy to announce a new update to my book on lambda expressions! A few pages more, and what’s important is that I heavily improved the consistency and some wording. All of that, thanks to valuable input from my readers and C++ experts. And today we’ll also have a look at one wording case - what’s a functor?

READ MORE...

Runtime Polymorphism with std::variant and std::visit

Runtime polymorphism usually connects with v-tables and virtual functions. However, in this blog post, I’ll show you a modern C++ technique that leverages std::variant and std::visit. This C++17 technique might offer not only better performance and value semantics but also interesting design patterns. Last Update: 2nd Nov 2020 (Passing arguments, Build time benchmark, fixes).

READ MORE...

C++20 Ranges, Projections, std::invoke and if constexpr

Continuing the topic from last week, let’s dive into the topic of std::invoke. This helper template function helps with uniform syntax call for various callable object types and can greately reduce the complexity of our generic code. Ranges and Projections In C++20 there are handful of rangified algorithms. As a simple example let’s say we want to sort a vector of integers:

READ MORE...

17 Smaller but Handy C++17 Features

When you see an article about new C++ features, most of the time you’ll have a description of major elements. Looking at C++17, there are a lot of posts (including articles from this blog) about structured bindings, filesystem, parallel algorithms, if constexpr, std::optional, std::variant… and other prominent C++17 additions.

READ MORE...