C++23 is going to bring us a few changes regarding move operations. It mostly means extended support in the standard library, but there is also one change directly in the language. Let’s start with that.
C++23 likes to move it!
by Sandor Dargo
From the article:
P2266R3 is a quite great proposal both in terms of its high-quality explanation and the amount of proposed changes in wording. I think if you’re interested in exploring a readable proposal, this might be the one.
Let me try to summarize it briefly.
Since the introduction of move semantics and rvalue references in C++11, we can return move-only types by value:
struct Widget { Widget(Widget&&); }; Widget one(Widget w) { return w; }C++14 extended this support so that even converting constructors accepting an rvalue type can be called to invoke an implicit move.
struct RRefTaker { RRefTaker(Widget&&); // here is the converting constructor }; RRefTaker two(Widget w) { return w; }As you can see, the two examples...
Add a Comment
Comments are closed.