Reverted the changes to ref_ptr<> for implicit cast to pointer.
This commit is contained in:
@@ -14,8 +14,6 @@
|
||||
#ifndef OSG_REF_PTR
|
||||
#define OSG_REF_PTR 1
|
||||
|
||||
#define AUTOMATIC_CAST_TO_POINTER
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** Smart pointer for handling referenced counted objects.*/
|
||||
@@ -55,13 +53,11 @@ class ref_ptr
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef AUTOMATIC_CAST_TO_POINTER
|
||||
// comparison operators for ref_ptr.
|
||||
inline bool operator == (const ref_ptr& rp) const { return (_ptr==rp._ptr); }
|
||||
inline bool operator != (const ref_ptr& rp) const { return (_ptr!=rp._ptr); }
|
||||
inline bool operator < (const ref_ptr& rp) const { return (_ptr<rp._ptr); }
|
||||
inline bool operator > (const ref_ptr& rp) const { return (_ptr>rp._ptr); }
|
||||
#endif
|
||||
|
||||
// comparion operator for const T*.
|
||||
inline bool operator == (const T* ptr) const { return (_ptr==ptr); }
|
||||
@@ -86,12 +82,6 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user