O_o
Does 'CComPtr:etach' alter the reference? Or does it just return the pointer and null the member for that particular instance of 'CComPtr'?
Can you give more information about this "certain circumstance"?
Soma
That's why CComPtr::Detach does. I can't remember more details right now. It's just from the documentation.Releases ownership of a pointer, sets the CComPtrBase::p data member variable to NULL, and returns a copy of the pointer.
But it should guarantee that it returns the pointer and does not Release it beforehand (which shared_ptr would do).
CComPtr has the advantage that the reference counting of COM objects is internal and publicly documented. If a shared_ptr gives up its pointer, it has to decrement the refcount, because there's no way for the user to do it.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law