return first example--Marius Elvert


return first example

by Marius Elvert

From the article:

It seems my “return first” post was not as enlightening as I had hoped. It was posted on reddit, and while the majority of commenters completely missed the point, it wasn’t really clear for those that did not just read the title. Either way, I am to blame for that – the examples and my reasoning were not very conclusive. So let me try clearing up the confusion with a better example...

12 Different Ways to Filter Containers in Modern C++--Bartlomiej Filipek

Many ways.

12 Different Ways to Filter Containers in Modern C++

by Bartlomiej Filipek

From the article:

Do you know how many ways we can implement a filter function in C++?

While the problem is relatively easy to understand - take a container, copy elements that match a predicate and the return a new container - it’s good to exercise with the Standard Library and check a few ideas. We can also apply some Modern C++ techniques.

Let’s start!

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