From: https://stackoverflow.com/a/3109981/462608
string(string&& that) // string&& is an rvalue reference to a string
{
data = that.data;
that.data = nullptr;
}
What have we done here? Instead of deeply copying the heap data, we have just copied the pointer and then set the original pointer to null (to prevent 'delete[]' from source object's destructor from releasing our 'just stolen data'). In effect, we have "stolen" the data that originally belonged to the source string.
Please explain the line in bold from the above quote.
that
is a rvalue so how would it be deleted from source object's destructor? Please give examples.