Add move constructor and move assignment operator
Eshanatnight opened this issue · comments
Eshan commented
Addition of move constructor
T(T&& obj): data(std::move(obj.data)) { obj.data = nullptr } // enables the resources owned by an rvalue object to be moved into an lvalue without copying
move assignment operator
T& operator=(T&& obj) { data = std::move(obj.data); return *this; } // enables the resources owned by an rvalue object to be moved into an lvalue without copying
This is important because a person is bound to come across these eventually. Although it might be a bit advanced for someone who is just starting out.