In case 10 , optimizations are likely to be involved that will change the actual implementation, but conceptually the following happens:
Thus, conceptually there is no copying - the link will refer to a temporary one.
As for std::move() : there may be some complex bits related to links, etc., but basically it's just a reference to an r-value. std::move() doesn't actually std::move() anything. It just turns its argument into a r value, so it can be transferred from.
"Moving" is not really a specific operation. While it is convenient to think about moving, it is important to note the value of l-value vs. r-value.
"Movement" is usually implemented by move constructors, assignment operators, and functions that use r-value references (for example, push_back() ). It is their implementation that makes the movement a real movement โ that is, they are implemented so that they can โstealโ r-value resources instead of copying them. This is because, as an r-value, it will no longer be available (or you promise the compiler).
This is why std::move() allows you to "move" - โโit turns its argument into an r-value, an alarm, "hey, compiler, I will no longer use this value l, you can let functions (for example, move ctors) examine it like r-value and steal from him. "
source share