Added implicit cast to T* to ref_ptr<>.

This commit is contained in:
Robert Osfield
2003-03-05 21:04:11 +00:00
parent 5e396d40e1
commit f9d8f3fa9d

View File

@@ -14,6 +14,8 @@
#ifndef OSG_REF_PTR
#define OSG_REF_PTR 1
#define AUTOMATIC_CAST_TO_POINTER
namespace osg {
/** Smart pointer for handling referenced counted objects.*/
@@ -104,6 +106,12 @@ class ref_ptr
inline const T* get() const { return _ptr; }
#ifdef AUTOMATIC_CAST_TO_POINTER
inline operator T* () { return _ptr; }
inline operator const T* () const { return _ptr; }
#endif
/** take control over the object pointed to by ref_ptr, unreference but do not delete even if ref count goes to 0,
* return the pointer to the object.
* Note, do not use this unless you are 100% sure your code handles the deletion of the object correctly, and