mizvekov wrote: > Correct me if I'm wrong but if the two objects own a buffer, then the swap > will just swap the buffers and the moved object is left on a valid but non > empty state, right?
No, there are three objects involved in the swap, one is a temporary which is default constructed. This temporary is swapped with the original object and so the original object ends up being in an empty state, and the temporary destroys the original object state when it goes out of scope. This way, move construction and assignment don't need to perform any manual memory management. https://github.com/llvm/llvm-project/pull/180484 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
