Why cant it just be kept at the same address and not copied
This is actually what move semantics generally does. It often keeps the resource (often memory, but could be file handles, etc.) in the exact same state, but it updates the references in the objects.
Imagine two vectors, src
and dest
. The src
vector contains a large block of data which is allocated on the heap, and dest
is empty. When src
is moved to dest
all that happens is that dest
is updated to point to the block of memory on the heap, whilst src
is updated to point to whatever dest
was pointing to, in this case, nothing.
Why is this useful? Because it means that vector
can be written with the confidence that only one vector will ever point to the block of memory it allocates. This means that the destructor can ensure that it cleans up the memory that has been allocated.
This can be extended for objects which manage other resources, such as file handles. It is now possible to write objects that can own a file handle. These objects can be movable, but not copyable. Because STL containers support movable objects, these can be put into containers far easier than they could in C++03. They file handle, or other resource, is guaranteed to only have on reference to it and the destructor can close it appropriately.