intermediate

Ways to Refactor Toggle/Boolean Parameters in C++--Bartlomiej Filipek

What's your preferred way?

Ways to Refactor Toggle/Boolean Parameters in C++

by Bartlomiej Filipek

From the article:

Boolean parameters in a function might be misleading and decrease its readability. If you have a poorly named function like:

DoImportantStuff(true, false, true, false);

As you can imagine, it’s not clear what all those parameters mean? What’s the first true? What does the last false mean? Can we improve code in such cases?

Let’s have a look at possible improvements...

SFINAE: Substitution Failure is not an Error | Top-Up C++ [C++ #02]--WolfSound

Are you familiar with it?

SFINAE: Substitution Failure is not an Error | Top-Up C++ [C++ #02]

by WolfSound

Summary of the video:

In this video, we are presenting SFINAE: Substitution Failure is not an Error, a feature or a characteristic of C++ related to templates. “Substitution failure is not an error” means that if the compiler fails to specialize a template with a given template argument list, it does not issue an error. It does when it cannot find any suitable function/class to be called/instantiated (either due to a lack of suitably declared functions/classes or an error during instantiation).

Fixing the crash that seems to be on a std::move operation--Raymond Chen

Which way do you prefer?

Fixing the crash that seems to be on a std::move operation

by Raymond Chen

From the article:

Last time, we looked at a crash that was root-caused to an order of evaluation bug if compiled as C++14. One solution to the problem is to switch to C++17 mode, but presumably the customer isn’t willing to make that drastic a change to their product yet. Maybe there’s something we can do that is less disruptive...

Strong Types for Safe Indexing in Collections – Part 2--Jonathan Boccara

Are you interested?

Strong Types for Safe Indexing in Collections – Part 2

by Jonathan Boccara

From the article:

In the previous article on strong types, we set out to find how to use strong types for safe indexing in collections.

More precisely, if we have two vectors with two indices to access them, how can we use strong types to make sure we use the right index for the right vector, and that we don’t swap them by mistake?