I looked at it from "I don't know what QtAutoDeleter does" perspective, nevermind that I wrote it.
The reason I say it is good is that the line implies that it will delete this. This is not good and allows me to more easily catch it than without (who knows what the function you pass it is going to do with it?).
If I were to use QtAutoDeleter, and the pointer wouldn't be deleted later, then that would be a bad thing, too, and being able to catch that would also be a good thing.
Really, I just threw that name out there. It's not so much an informed decision or some carefully picked name or some such. It's just a casual name I picked so I could decorate the interface and say "we'll take care of deleting this, so you shoukdn't".
Is that what you're complaining about? That edit is undecorated?O_o
Let me tell you something: `edit' is an undecorated pointer.Code:auto edit = new QTextEdit(auto_deleter(this));
Again: The changes to the code that you and you alone recommended decorates `this' not `edit'.
Once more: the changes you suggested leaves the pointer to the object being registered for deletion a normal, simple, raw, dumb, undecorated, as vanilla as you please pointer.
Seriously, you just skewed your own suggestion to such a perverse shape not even Cthulhu could make it out without its eyes watering.
The beast that dwells in a non-euclidean space is looking at this thread scratching its head because you've just told us that the code that self-documents as doing something completely unrelated to its actual purpose is superior to the code that you find "insane" only because it isn't self-documenting.
OK, so that was bad of me. I just copied that from the OP. In this case, I didn't pay any attention to edit, but instead to this.
Let me give a better example to eliminate that, then:
Instead of:Code:auto edit = auto_deleter(new QTextEdit edit(blah)); this->AddControl(edit);
Code:auto edit = new QTextEdit edit(blah); this->AddControl(edit);