The Nightmare of Move Semantics for Trivial Classes
Play The Nightmare of Move Semantics for Trivial Classes
Assume, we implement a very simple class having just multiple string members. Even ordinary application programmer prefer to make it simple and fast. You think you know how to do it? Well beware! It can become a lot harder than you initially might assume. So, let’s look at a trivial class with multiple string members and use live coding to see the effect using different implementation approaches (using constructors passing by value, by reference, by perfect forwarding, or doing more sophisticated tricks). Sooner than later we will fall into the deep darkness of universal/forwarding references, enable_if, type traits, and concepts.