Skip to content

Latest commit

 

History

History
9 lines (7 loc) · 548 Bytes

13.38.md

File metadata and controls

9 lines (7 loc) · 548 Bytes

If we use copy and swap to define the Message copy-assignment operator, we will

  1. add the copyed message to folders containing the original message,
  2. remove both the copyed message and the lhs message from their folders,
  3. swap the value of the lhs and the copyed message,
  4. add the swapped lhs and the copy-swapped message to their folders,
  5. remove the copy-swapped message from its folders.

This means we call copy-constructor one time, swap one time and destructor one time, and it is much more work than the current version.