What std::exchange does, and how to remember it--Jonathan Boccara

If you had troubles.

What std::exchange does, and how to remember it

by Jonathan Boccara

From the article:

std::exchange was introduced in the C++ standard library in C++14 under the header <utility>.

Its name suggests that it’s a general-purpose and useful function, and its template prototype working with any type confirms this impression.

I don’t know about you, but I always had a problem with std::exchange: I couldn’t remember what it was doing. I learnt several times the operations that std::exchange performs, but each time I forgot them soon after.

Then at some point it clicked: std::exchange is a setter returning the old value. Ignoring the name “exchange” but thinking of it as a “setter” helped me make it stick to my mind.

It might just be me having a hard time with std::exchange for some reason. But just in case you also have issues remembering the operations of std::exchange, let’s see why std::exchange has this meaning, and why this meaning is not obvious from its name.

This should help you remember it once and for all...

C++ Coroutines in Visual Studio 2019 Version 16.8--Jonathan Emmett

c++20 is coming.

C++ Coroutines in Visual Studio 2019 Version 16.8

by Jonathan Emmett

From the article:

It’s been a long journey for coroutines in C++ and in MSVC. We announced an early preview of resumable functions in 2013, followed up by the /await switch and initial C++ standardization proposals in 2014, to proposal revisions in 2015, and have continued tracking the Coroutines TS (Technical Specification) progress through Visual Studio 2017 and 2019. With the adoption of coroutines into the C++ standard in 2019, we are now pleased to announce feature completion of C++20 coroutines in Visual Studio 2019 version 16.8...

Standard C++20 Modules support with MSVC in Visual Studio 2019 version 16.8--Cameron DaCamara

Tools are getting to 20.

Standard C++20 Modules support with MSVC in Visual Studio 2019 version 16.8

by Cameron DaCamara

From the article:

It has been some time since our last update regarding C++ Modules conformance. The toolset, project system, and IDE teams have been hard at work to create a first class C++ Modules experience in Visual Studio 2019. There is a lot to share, so let’s get right into it...

Concept archetypes — update--Andrzej Krzemieński

Not so easy, but still useful.

Concept archetypes — update

by Andrzej Krzemieński

From the article:

An observant reader indicated that in the previous post where I was trying to implement a concept archetype — a type with minimal interface that models a given concept — I actually failed. This deserves a closer examination...

Refactoring from single to multi purpose

Working on an old project, it came to my mind that I do this refactoring from one static path to multiple options for the 2nd time this year...

Refactoring from single to multi purpose

by Jens Weller

From the article:

For the second time this year I'm refactoring a program from a single purpose to have two or more modes of operation. Both times the start and end result is similar, just the processing is different. A classic case of using polymorphism.

The first program was a tool to process videos from speakers, find a face and export the subframe around it into a new video. The first mode was a good approach to test it, and gave results for some speakers. The second mode did a complete scan first, and then gave a smoother video for some videos. Still, both modes had to be retained...

Replacing unique_ptr with C++17's std::variant a Practical Experiment--Bartlomiej Filipek

variant shows his capabilities.

Replacing unique_ptr with C++17's std::variant a Practical Experiment

by Bartlomiej Filipek

From the article:

Some time ago I wrote about a new way to implement runtime polymorphism which is based not on virtual functions but on std::visit and std::variant. Please have a look at this new blog post where I experiment with this approach on my home project. The experiment is more practical than artificial examples.

See advantages, disadvantages and practical code issues.

JetBrains C++ Team At CppCon 2020--Anastasia Kazakova

Are you  attending?

JetBrains C++ Team At CppCon 2020

by Anastasia Kazakova

From the article:

The CppCon conference will be taking place fully online this year. And of course the JetBrains C++ team wouldn’t dream of missing the biggest C++ community event of the year!

We’ll join CppCon 2020 with a one-day virtual room hosted by CppCon over Remo on Thursday, September 17. And the great thing is that our CppCon virtual room is open to everyone!

Two new ticket types for Meeting C++

Some news from Meeting C++: there is now one ticket for virtual events of Meeting C++ and for Meeting C++ online a limited amount of sponsored tickets is available

Two new ticket types for Meeting C++

by Jens Weller

From the article:

Today I can announce two important updates for Meeting C++ online and Meeting C++ 2020!

One online ticket for Meeting C++ 2020 and Meeting C++ online

While you can buy separate tickets for Meeting C++ online and 2020, now there is an online ticket for all virtual Meeting C++ events in 2020 available! You can get it in the ticketshop of Meeting C++ 2020 only, as this is the easiest process to offer it. The ticket enables you to attend these online conferences...