But does the compiler-generated move-constructor nulls out the source object?
No. Because what does it mean to "null out" the source object? There is no clear and general answer to this, it is a matter of context. For some objects, it is useless to "nullify" it (as in, set it to zero). For some objects, it would be erroneous to do so. And for other objects, it would correct.
For the compiler-generated move-constructor, the rule is pretty simple. If you have a class like this:
class Foo {
public:
Bar1 a;
Bar2 b;
//.. some member functions and stuff..
};
Then, the compiler-generated move-constructor will be exactly equivalent to this:
Foo(Foo&& rhs) : a(std::move(rhs.a)), b(std::move(rhs.b)) { };
It's that simple. It will just use the move-constructors of all the data members of the class. This solves the problem of having to know how to move an object (nullify the source or not). The assumption here is that if you don't provide a move-constructor (or explicitely delete it), then the compiler can assume that it is correct to simply move all the individual data members (with their appropriate move-constructors). This is exactly the same assumption as for the compiler-generated copy-constructor, if you don't provide one, the compiler assumes that it is OK to simply copy the data members individually. In the case of a resource-holding class, like the int_vector
in my tutorial, this assumption does not work, i.e., it is not safe to simply …