intermediate

Inheritance Without Pointers--Jonathan Boccara

What do you think?

Inheritance Without Pointers

by Jonathan Boccara

From the article:

Inheritance is a useful but controversial technique in C++. There is even a famous talk by Sean Parent called Inheritance is the base class of evil. So inheritance is not the most popular feature of the C++ community.

Nevertheless, inheritance is useful, and widely used by C++ developers.

What is the problem of inheritance? It has several problems, and one of them is that it forces us to manipulate objects through pointers...

Inlining and Compiler Optimizations--Scott Wolchok

The complicated world of optimisations.

Inlining and Compiler Optimizations

by Scott Wolchok

From the article:

Why is inlining so important in C++? Clearly, it reduces function call overhead: if a function is inlined, there is no need to spend time setting up its arguments, jumping to it, creating a stack frame, and then undoing all that upon returning. More interestingly, though, inlining enables other compiler optimizations. In this article, I will show examples of constant propagation and loop-invariant code motion (LICM). Then, I will explain how inlining enables these optimizations to apply more widely and show an example of the consequences when that doesn’t happen...

How to Share Code with Const and Non-Const Functions in C++--Bartlomiej Filipek

How do you do it?

How to Share Code with Const and Non-Const Functions in C++

by Bartlomiej Filipek

From the article:

During the development of a container-like type, I run into the problem of how to share code between a const and non-const member functions. In this article, I’d like to explain what are the issues and possible solutions. We can even go on a bleeding edge and apply some C++20 features. Which technique is most friendly?

A look at next weeks Meeting C++ 2020 online conference

Looking at how next weeks Meeting C++ 2020 will be online

A look at next weeks Meeting C++ 2020 online conference

by Jens Weller

From the article:

First, Meeting C++ 2020 is an online conference, the planned onsite part is canceled. More about this in the last paragraph, as first, lets look whats happening next week!

The online part

Next weeks conference will consist of two tracks hosted in remo, one for talks and one for communication/networking/live video chat...

Tricks with Default Template Arguments--Jonathan Müller

Did you know?

Tricks with Default Template Arguments

by Jonathan Müller

From the article:

Just like regular function parameters, template parameters can also have default parameters. For class templates, this behaves mostly just like default function arguments: if you pass fewer template arguments than required, default template arguments are used to fill the remaining places. However, for function templates, it gets more complicated as template parameters for functions can be deduced by the normal function arguments. This leads to some interesting side-effects. In particular, default arguments of template parameters don’t need to be put at the end!

Let’s take a look at a couple of things we can do with default template arguments...

C++ Compile time conditional struct member variables--Saleem Ahmad

Before we get metaclasses one day?

C++ Compile time conditional struct member variables

by Saleem Ahmad

From the article:

C++ has rich set of features to do compile time calculations and optimizations to generate a better code. In one of code segment I have very large data structure in which few member variables are not used based on compile time if constexpr condition, but these variables are logged in the log line...

std::exchange Patterns: Fast, Safe, Expressive, and Probably Underused--Ben Deane

Do you know about it?

std::exchange Patterns: Fast, Safe, Expressive, and Probably Underused

by Ben Deane

From the article:

This blog post has been a long time in the making. I gave a lightning talk on std::exchange at CppCon 2017; Jonathan first asked me to write something about std::exchange in January 2019; now here we are in the strange days of the second half of 2020. But although much has changed in the outside world, I would guess that not much has changed in most C++ codebases and in the minds of many C++ programmers with respect to using std::exchange. It could still do with more publicity and more recognition of potential use cases...