6 m_pAllocator =
nullptr;
13 m_pInstance = instance.m_pInstance;
14 m_pAllocator = instance.m_pAllocator;
16 AddReferenceIfValid();
23 m_pInstance = pInstance;
24 m_pAllocator = pAllocator;
26 AddReferenceIfValid();
32 m_pInstance = other.m_pInstance;
33 m_pAllocator = other.m_pAllocator;
35 AddReferenceIfValid();
42 m_pInstance = other.m_pInstance;
43 m_pAllocator = other.m_pAllocator;
45 AddReferenceIfValid();
52 m_pInstance = other.m_pInstance;
53 m_pAllocator = other.m_pAllocator;
55 other.m_pInstance =
nullptr;
56 other.m_pAllocator =
nullptr;
63 m_pInstance = other.Release(m_pAllocator);
65 AddReferenceIfValid();
71 m_pInstance =
nullptr;
72 m_pAllocator =
nullptr;
78 ReleaseReferenceIfValid();
85 ReleaseReferenceIfValid();
87 m_pInstance = instance.m_pInstance;
88 m_pAllocator = instance.m_pAllocator;
90 AddReferenceIfValid();
98 if (m_pInstance != other.m_pInstance)
100 ReleaseReferenceIfValid();
102 m_pInstance = other.m_pInstance;
103 m_pAllocator = other.m_pAllocator;
105 AddReferenceIfValid();
115 if (m_pInstance != other.m_pInstance)
117 ReleaseReferenceIfValid();
119 m_pInstance = other.m_pInstance;
120 m_pAllocator = other.m_pAllocator;
122 AddReferenceIfValid();
132 if (m_pInstance != other.m_pInstance)
134 ReleaseReferenceIfValid();
136 m_pInstance = other.m_pInstance;
137 m_pAllocator = other.m_pAllocator;
139 other.m_pInstance =
nullptr;
140 other.m_pAllocator =
nullptr;
150 ReleaseReferenceIfValid();
152 m_pInstance = other.Release(m_pAllocator);
154 AddReferenceIfValid();
162 ReleaseReferenceIfValid();
176 ReleaseReferenceIfValid();
206 return m_pInstance !=
nullptr;
212 return m_pInstance == rhs.m_pInstance;
218 return m_pInstance != rhs.m_pInstance;
224 return m_pInstance < rhs.m_pInstance;
230 return !(rhs < *
this);
242 return !(*
this < rhs);
248 return m_pInstance ==
nullptr;
254 return m_pInstance !=
nullptr;
260 return m_pInstance <
nullptr;
266 return m_pInstance <=
nullptr;
272 return m_pInstance >
nullptr;
278 return m_pInstance >=
nullptr;
284 if (m_pInstance !=
nullptr)
286 m_pInstance->AddRef();
293 if (m_pInstance !=
nullptr)
295 if (m_pInstance->ReleaseRef() == 0)
298 PL_DELETE(m_pAllocator, pNonConstInstance);
301 m_pInstance =
nullptr;
302 m_pAllocator =
nullptr;
Base class for all memory allocators.
Definition Allocator.h:23
A Shared ptr manages a shared object and destroys that object when no one references it anymore....
Definition SharedPtr.h:10
void Clear()
Destroys the managed object if no one else references it anymore and resets the shared ptr.
Definition SharedPtr_inl.h:174
T * operator->() const
Provides access to the managed object.
Definition SharedPtr_inl.h:186
plSharedPtr< T > & operator=(const plInternal::NewInstance< U > &instance)
Sets the shared ptr from a freshly created instance through PL_NEW or PL_DEFAULT_NEW.
bool operator==(const plSharedPtr< T > &rhs) const
Compares the shared ptr against another shared ptr.
Definition SharedPtr_inl.h:210
T * Borrow() const
Borrows the managed object. The shared ptr stays unmodified.
Definition SharedPtr_inl.h:168
T & operator*() const
Provides access to the managed object.
Definition SharedPtr_inl.h:180
~plSharedPtr()
Destroys the managed object using the stored allocator if no one else references it anymore.
Definition SharedPtr_inl.h:76
A Unique ptr manages an object and destroys that object when it goes out of scope....
Definition UniquePtr.h:10
Definition Allocator_inl.h:18
typename std::remove_const< T >::type NonConstType
removes const qualifier
Definition TypeTraits.h:209