Tag: c++11

C++ curiosities: one does not simply move a const object

When I learned about the C++11 move semantics for the first time, it was mighty confusing to me. My mental model of moving something, as in “move a physical object from point A to point B”, was clearly not an adequate mental model for what C++11 calls “moving an object”. And one of the examples […]

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 […]

Boost.Spirit + Flatbuffers + Catch + Biicode + CLion + Github

This weekend I’m test-driving several new technologies. OK, OK, maybe not so new for everyone else, but new for me. I’m trying to write a parser for the Flatbuffers IDL grammar using Boost.Spirit, I’m referencing Boost using Biicode, I’m testing the code using Catch, I’m editing the project in CLion, and I’m pushing the results […]

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 […]