Quote:
Kind of a minor distinction IMO. if you agree it's ok and there are legitimate use cases for manually invoking destructors of owned objects, and you agree that it's ok to write 'delete this', indicating that an object owns itself, then i dont see why this is anything other than a natural extension.
I suppose the difference is that in one case you'd be doing it with an automatic object and therefore you must at any cost succeed in replacing this. You can't avoid the destructor being called on the object.
When you do it with an owned object (as vector and variant do), those wouldn't be destroyed automatically when the owner goes out of scope. They were explicitly created and have to be explicitly destroyed (and you can easily omit the last step if you lost the object in the meantime).
delete this also wouldn't be done on an automatic object.
-------
Go ahead and use with objects whose construction cannot fail. But still there might be a better use case than just hiding const_cast, and reseating references.