At this point, writing the copy constructor and assignment operator pair is well-defined; a quick search will lead you to plenty of hits on how to properly code these.
Now that the move constructor has entered the mix, is there a new “best” way?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Preferably, they’ll just be
= default;, since the member types should be of resource managing types that hide the move details from you, likestd::unique_ptr. Only the implementors of those “low level” types should bother with dealing with that.Remember that you only need to bother with move semantics if you’re holding an external (to your object) resource. It’s completely useless for “flat” types.