|
发表于 2014-6-5 16:28:15
|
显示全部楼层
我的意思是自己看下源码。
// implicit output conversion
operator T*() const { return _ptr; }
T* get() const { return _ptr; }
T* release() { T* tmp=_ptr; if (_ptr) _ptr->unref_nodelete(); _ptr=0; return tmp; }
T* _ptr;
/** Decrement the reference count by one, indicating that
a pointer to this object is referencing it. However, do
not delete it, even if ref count goes to 0. Warning, unref_nodelete()
should only be called if the user knows exactly who will
be responsible for, one should prefer unref() over unref_nodelete()
as the latter can lead to memory leaks.*/
int unref_nodelete() const;
|
|