intermediate

C++ moves for people who don’t know or care what rvalues are--Topher Winward

Is it simpler that way?

C++ moves for people who don’t know or care what rvalues are

by Topher Winward

From the article:

When I was first learning about move semantics in C++, I kept reading articles that explained in terms of other scary sounding jargon — lvalues, rvalue references, memcpy, ownership. None of these things are strictly necessary to know about to understand the core of move semantics. (Though, the more you learn about them, the greater your understanding of move semantics will become.)

You may have heard of move semantics, and may know that they’re “faster”, but not why, or even how to move something. (Here “moves” and “move semantics” mean the same thing.)

This article will deliberately simplify or ignore some concepts (like constructors, rvalue references, stack vs heap) to make the core idea of moving easier to follow, so don’t worry if you already know this stuff and see something that isn’t technically correct. I’ll mark clarifications for these with a number. This article is aimed at those writing everyday (non-library) code, with little to no existing understanding of move semantics, to help get over the initial conceptual hurdle...

The pImpl Idiom--Arne Mertz

In one word.

The pImpl Idiom

by Arne Mertz

From the article:

The pImpl idiom is a useful idiom in C++ to reduce compile-time dependencies. Here is a quick overview of what to keep in mind when we implement and use it...

C++ Weekly Episode 149: C++20's Lambda Usability Changes—Jason Turner

Episode 149 of C++ Weekly.

C++20's Lambda Usability Changes

by Jason Turner

About the show:

C++20 brings many different changes to lambdas, and two of these changes greatly affect the ways in which lambdas can be used. In this episode Jason discusses the use of lambdas in unevaluated contexts and the default constructability of lambdas in C++20.

Functional Programming Is Not a Silver Bullet--Jonathan Boccara

Nothing is perfect.

Functional Programming Is Not a Silver Bullet

by Jonathan Boccara

From the article:

The past few years have seen a boost in popularity of the functional programming paradigm. Languages that were used mostly in academic circles for decades are now in broader use amongst programmers. And every couple of months, another functional language hits the news and gets its trail of followers.

Why is that? Functional programming allow for safer and more robust code, in part due to one of its core principles: values are not mutable. A consequence of this is that there is no side effects. We can apply this principle in any language, including in C++, by coding with the least side effects possible.

While it certainly helps putting together a better design of code, it’s important to realize that it’s not the panacea, that this principle doesn’t solve in itself all design issues. Nothing is the panacea anyway, but in this time of gold rush towards functional programming, we could be tricked into thinking it will automatically lead to good design.

Functional programming is known to reduce coupling in code. We’ll briefly go over what coupling is, what sort of coupling functional programming prevents, and how some other dangerous forms of coupling can still sneak in even with functional programming. You want to pay attention to those to preserve the design of your code...

What is an Allocator?--Vanand Gasparyan

Basic, but complex.

What is an Allocator?

by Vanand Gasparyan

From the article:

This is one of the many beautiful questions you can think on or be asked at interviews if your native coding language is C++. The beautiful thing about this question is that you answer it again and again as you grow and gain more experience. Similarly, when you’re being interviewed for an internship, knowing that there is such a thing somewhere in STL might be enough, whereas later you’ll be expected to write your own custom allocator...