In my last post I tried to show the general use of move-semantics. While writing it, I figured “Wait a minute, couldn’t I just use a non-const copy-constructor instead?”.
As can be seen in the following code snippet, yes it does work. Perfectly.
So why all the hazzle with these weird new move-semantics then? Short anser: principle of least astonishment (POLA).
Long anser: Consider the following piece of code:
Code should do exactly what expected and only what is expected.