I am searching for an answer to the following explaination (from the book "A tour of C++")
MyClass& operator=(const MyClass&) // copy asignment: clean up target and copy
I've never cleaned up a target (or at least I don't get what does it mean) when copying so:
- The ideea of copying isn't that of having two identical things?
- If i clean up the target, wouldn't that be a
move
? What exactly is meant by clean up target?
- the reference is also
const
so I wouldn't be able to modifying it
- the reference is also
Below in the book it states:
MyClass& operator=(MyClass&&) // move assignment: clean up target and move
Here it makes sense to clean up target as this is how I understand the move
-ing thing works