Tag: move

C++ curiosities: move semantics, sizeof, areaof, and pointy types

This post continues the topic raised in “C++ curiosities: move semantics is not about moving”. Last time we’ve seen how a move operation can be split into 2 steps: “shallow copying” and “destructor disarmament”. This time I’ll show a way of using “areaof” to understand the benefits of move operations on a given type, and […]

C++ curiosities: move semantics is not about moving

C++ move semantics is not about moving, but about keeping as many things as possible where they already are. Yes, at a very high level of abstraction one can say that move semantics is about “moving ownership” of a resource from on object to another. But performance benefits of move semantics do not come from […]

C++ curiosities: std::move that doesn’t move

Despite its name, std::move doesn’t move anything. std::move is no more than a type cast. It has 2 major purposes in life: to return an “rvalue reference” to its argument and to mislead people into thinking it does more than that. In fact, you can call the bluff by calling static_cast<T&&> explicitly instead of std::move and […]