summaryrefslogtreecommitdiff
path: root/indra/llcommon/llpointer.h
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-05-20 19:28:20 -0700
committerRichard Linden <none@none>2013-05-20 19:28:20 -0700
commit11cee0c140af90564f5616d3464f29abae4d585f (patch)
tree16c6faf318d805aaaceb7c196d91170e92564b77 /indra/llcommon/llpointer.h
parent13f43fdc5bd046f7857f06254c84b8993bdcc50a (diff)
parentab5106535758393e02b075d1e404e4e1fcf81abf (diff)
Automated merge with ssh://hg.lindenlab.com/richard/viewer-interesting
Diffstat (limited to 'indra/llcommon/llpointer.h')
-rw-r--r--indra/llcommon/llpointer.h33
1 files changed, 15 insertions, 18 deletions
diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h
index f03551045e..b9a9bf1ef0 100644
--- a/indra/llcommon/llpointer.h
+++ b/indra/llcommon/llpointer.h
@@ -166,7 +166,7 @@ protected:
};
template<typename Type>
-class LLCopyOnWritePointer
+class LLCopyOnWritePointer : public LLPointer<Type>
{
public:
typedef LLCopyOnWritePointer<Type> self_t;
@@ -175,43 +175,40 @@ public:
{}
LLCopyOnWritePointer(Type* ptr)
- : mPointer(ptr)
+ : LLPointer(ptr)
{}
LLCopyOnWritePointer(LLPointer<Type>& ptr)
- : mPointer(ptr)
+ : LLPointer(ptr)
{}
Type* write()
{
makeUnique();
- return mPointer.get();
+ return mPointer;
}
void makeUnique()
{
- if (mPointer.notNull() && mPointer.get()->getNumRefs() > 1)
+ if (notNull() && mPointer->getNumRefs() > 1)
{
- mPointer = new Type(*mPointer.get());
+ *(LLPointer*)(this) = new Type(*mPointer);
}
}
+ /*operator BOOL() const { return (mPointer != NULL); }
+ operator bool() const { return (mPointer != NULL); }
+ bool operator!() const { return (mPointer == NULL); }
+ bool isNull() const { return (mPointer == NULL); }
+ bool notNull() const { return (mPointer != NULL); }
- operator BOOL() const { return (BOOL)mPointer; }
- operator bool() const { return (bool)mPointer; }
- bool operator!() const { return !mPointer; }
- bool isNull() const { return mPointer.isNull(); }
- bool notNull() const { return mPointer.notNull(); }
-
- bool operator !=(Type* ptr) const { return (mPointer.get() != ptr); }
- bool operator ==(Type* ptr) const { return (mPointer.get() == ptr); }
+ bool operator !=(Type* ptr) const { return (mPointer != ptr); }
+ bool operator ==(Type* ptr) const { return (mPointer == ptr); }
bool operator ==(const LLCopyOnWritePointer<Type>& ptr) const { return (mPointer == ptr.mPointer); }
bool operator < (const LLCopyOnWritePointer<Type>& ptr) const { return (mPointer < ptr.mPointer); }
bool operator > (const LLCopyOnWritePointer<Type>& ptr) const { return (mPointer > ptr.mPointer); }
- operator const Type*() const { return mPointer.get(); }
- const Type* operator->() const { return mPointer.get(); }
-protected:
- LLPointer<Type> mPointer;
+ operator const Type*() const { return mPointer; }
+ const Type* operator->() const { return mPointer; }*/
};
#endif