CPP Crash Course: Move Assignment notes.
Today I added the final implementation of the Move Assignment Operator to the example I am working on from CPP Crash Course. It is still a work in progress, and I have some more notes to add, but it works and I have included the valgrind output in a separate text file.
More explanation will be forthcoming, but I will briefly list some concepts and ideas that are crucial for understanding how this works:
- rvalue / lvalue references
- The default behaviour of copy and move assignment operators.
- Constructors and Class Objects.
Without understanding these concepts, you will find it difficult to understand how the copy and move assignment operators work. Without a lot of practise and experience, is easy to forget crucial details in how these ideas are implemented. So it is important whether you are learning for the first time, or reviewing the knowledge, that you check the reference documents and ensure that you really know what is going on here.
Links to the files:
https://github.com/pereiradaniel/CPP_CRASH_COURSE/blob/master/P1C4/simplestring_move_constructor.cpp
https://github.com/pereiradaniel/CPP_CRASH_COURSE/blob/master/P1C4/simplestring_move_constructor.txt