Quote Originally Posted by Elysia View Post
I do not see the harm if used properly. If detaching the pointer, and if the reference count is one, then you are responsible for deleting it.
The reference count being one is the non-problematic case.

If the reference count is not 1, then I must never call delete on the pointer. I can use the pointer as I wish, and modifying its memory, but I cannot delete the object, since that would make the smart pointer attempt to free already freed memory at some point.
So basically, detaching when the reference count is not 1 does what? Give you the raw pointer? Perhaps also reset the smart pointer? What use is that?

I would be very interested in seeing a good use case for your detach() semantics. I claim that there is none - that any use case you may have results from not distinguishing between various types of smart pointers (scoped_ptr, shared_ptr, move_ptr).

What I see as dangerous are these weak_ptrs. They can be abused and cause all sorts of havoc, more so than Detach, or equally much.
Do you have specific scenarios in mind, or is that a gut reaction?