The default move constructor and move asignment generated by the compiler will call move constructor / asignment for each member of the class.
If your class has only raw elements, for example, "char * buffer", you should write your own move operations.
If your class has only “managed members,” such as “vector,” the default move operations for your class will be fine, as it delegates the operation to each member.
If your class has “managed members” mixed with “raw members”, vector and int *, for example, your move operations will have to manually move raw resources and invoke move operations for managed objects:
class MyObject { public:
std :: move (other.vector1) is required because inside that other.vector1 function is an lvalue. We must tell the compiler that we will not use the value of vector1 later in the functional code so that its value can be moved.
source share