Um, what's wrong with the simpler<p><pre><code> if (this == &that) return *this;
TFoo tmp(that);
swap(tmp);
return *this;
</code></pre>
(Assume swap does not throw, it's trivial to implement because swapping pointers wouldn't throw.) This way the constructor of tmp takes care of destroying partially-constructed objects and you don't need to do it by hand. It seems like the clean up code just repeats what the compiler would automatically generate for you in a constructor.<p>[This is from 1997, btw.]
It's an oft-quoted fact that Rust is meant to take stuff that good C/C++ programmers already do and build it into the language. If you weren't convinced of this before reading this post, then pay close attention to how important the author considers pointer ownership to be.