voidMove(char** dst, char** src){ // normal form // *dst = *src; // *src = nullptr;
// write it in a line *dst = std::exchange(*src, nullptr); }
Rule of five
Any class for which move semantics are desirable, has to declare all five special member functions: destructor, copy-constructor, copy-assignment operator, move constructor and move-assignment operator.
When move constructor or move-assignment operator are provided, copy-constructor and copy-assignment operator are deleted implicitly.
Unlike Rule of Three, failing to provide move constructor and move assignment is usually not an error, but a missed optimization opportunity.
Therefore, the best practice is to provide the five special member functions.