This is where I got most of this information: http://en.cppreference.com/w/cpp/language/move_constructor
Apparently these are the conditions for the implicitly generated move constructor to work:
- there are no user-declared copy constructors
- there are no user-declared copy assignment operators
- there are no user-declared move assignment operators
- there are no user-declared destructors
- the implicitly-declared move constructor is not defined as deleted
- if a user declared move constructor is present, it is still possible to still force the generation of the implicitly declared move constructor with the keyword
default
My questions are:
- Is it safe to rely on implicit automatic move constructor?
- How do I check if it really worked instead of default copy constructor?
- Finally, and most importantly, is it a good idea and why? Or is it always better to define my own?
I am more inclined to follow the rule of three and manually create a destructor, a copy and move constructor, and a copy and move assignment operator, but I'm just curious about this implicit one.