I am unable to understand how a move constructor works in this example of code. If someone could break down the process of what is taking place and explain to me on why to use a move constructor.
Example from "SamsTeachYourself: C++ in One Hour a Day"Code:class MyString { MyString(MyString&& MoveSource) { if( MoveSource.Buffer != NULL ) { Buffer = MoveSource.Buffer; // take ownership i.e. 'move' MoveSource.Buffer = NULL; // set the move source to NULL i.e. free it } } };