Item-14 Copy behavior in resource-managing classes
· β 4 min read
Copying an RAII object entails copying the resource it manages, so the copying behavior of the resource determines the copying behavior of the RAII object.
Copying an RAII object entails copying the resource it manages, so the copying behavior of the resource determines the copying behavior of the RAII object.
Solve self assignment situation in operator= by comparing addresses of source and target objects, careful statement ordering, and copy-and-swap
.