Added doxygen comment for ref_ptr<>::release().

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14630 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-12-22 09:50:10 +00:00
parent 8e901ebbac
commit 73221e8682

View File

@@ -94,6 +94,10 @@ class ref_ptr
bool operator!() const { return _ptr==0; } // not required
bool valid() const { return _ptr!=0; }
/** release the pointer from ownership by this ref_ptr<>, decrementing the objects refencedCount() via unref_nodelete() to prevent the Object
* object from being deleted even if the reference count goes to zero. Use when using a local ref_ptr<> to an Object that you want to return
* from a function/method via a C pointer, whilst preventing the normal ref_ptr<> destructor from cleaning up the object. When using release()
* you are implicitly expecting other code to take over managment of the object, otherwise a memory leak will result. */
T* release() { T* tmp=_ptr; if (_ptr) _ptr->unref_nodelete(); _ptr=0; return tmp; }
void swap(ref_ptr& rp) { T* tmp=_ptr; _ptr=rp._ptr; rp._ptr=tmp; }