The Wikipedia article about special member functions doesn’t contain any reference to move constructors and move assignment operators.
I would like to update the entry but I’m not sure what the 0x standard says.
What are the rules regarding these two functions? Are they automatically generated by the compiler and if so when?
Edit: I’ve updated the Wikipedia page, if anyone feels like it please help the community by editing it into shape (if needed).
Keeping in mind C++0x isn’t quite standard yet, this is subject to change. From the FCD (PDF link), move constructors and move assignment operators can indeed be explicitly defaulted, and even implicitly defaulted.*****
I’m just going to quote (heavily abridged) a bunch of stuff that might be useful to glance at:
On explicitly-defaulted functions, §8.4.2/1-2:
On special member functions, §12/1:
About implicitly declared functions, §12.8/8-11:
On implicitly deleted default functions, §12.8/12:
§12.8/13-18 defines how the functions should work when they are implicitly generated.
§12.8/19 then does the same thing as §12.8/8 did, except with the copy-assignment and move-assignment operators. They are similar enough not to warrant quoting here.
For a more complete picture, you’ll want to read those sections in their entirety, but that’s the general idea. I’m glad we get implicit move semantics.
*But like defaulted copy-functions, they might not always have the correct behavior! The Big Three should become The Big Five. (For example, The Big Three are implemented whenever we need to deep-copy something. We also need to make sure we do a "deep-move", where the source’s data is nulled/reset. This is not done implicitly.)