9 m_pInstance = instance.m_pInstance;
10 m_pAllocator = instance.m_pAllocator;
17 m_pInstance = pInstance;
18 m_pAllocator = pAllocator;
25 m_pInstance = other.m_pInstance;
26 m_pAllocator = other.m_pAllocator;
28 other.m_pInstance =
nullptr;
29 other.m_pAllocator =
nullptr;
49 m_pInstance = instance.m_pInstance;
50 m_pAllocator = instance.m_pAllocator;
61 m_pInstance = other.m_pInstance;
62 m_pAllocator = other.m_pAllocator;
64 other.m_pInstance =
nullptr;
65 other.m_pAllocator =
nullptr;
81 T* pInstance = m_pInstance;
83 m_pInstance =
nullptr;
84 m_pAllocator =
nullptr;
92 T* pInstance = m_pInstance;
93 out_pAllocator = m_pAllocator;
95 m_pInstance =
nullptr;
96 m_pAllocator =
nullptr;
110 if (m_pAllocator !=
nullptr)
112 PL_DELETE(m_pAllocator, m_pInstance);
115 m_pInstance =
nullptr;
116 m_pAllocator =
nullptr;
134 return m_pInstance !=
nullptr;
140 return m_pInstance == rhs.m_pInstance;
146 return m_pInstance != rhs.m_pInstance;
152 return m_pInstance < rhs.m_pInstance;
158 return !(rhs < *
this);
170 return !(*
this < rhs);
176 return m_pInstance ==
nullptr;
182 return m_pInstance !=
nullptr;
188 return m_pInstance <
nullptr;
194 return m_pInstance <=
nullptr;
200 return m_pInstance >
nullptr;
206 return m_pInstance >=
nullptr;
213PL_ALWAYS_INLINE
bool operator==(
const plUniquePtr<T>& lhs,
const T* rhs)
215 return lhs.
Borrow() == rhs;
219PL_ALWAYS_INLINE
bool operator==(
const plUniquePtr<T>& lhs, T* rhs)
221 return lhs.
Borrow() == rhs;
225PL_ALWAYS_INLINE
bool operator!=(
const plUniquePtr<T>& lhs,
const T* rhs)
227 return lhs.
Borrow() != rhs;
231PL_ALWAYS_INLINE
bool operator!=(
const plUniquePtr<T>& lhs, T* rhs)
233 return lhs.
Borrow() != rhs;
237PL_ALWAYS_INLINE
bool operator==(
const T* lhs,
const plUniquePtr<T>& rhs)
239 return lhs == rhs.
Borrow();
243PL_ALWAYS_INLINE
bool operator==(T* lhs,
const plUniquePtr<T>& rhs)
245 return lhs == rhs.
Borrow();
249PL_ALWAYS_INLINE
bool operator!=(
const T* lhs,
const plUniquePtr<T>& rhs)
251 return lhs != rhs.
Borrow();
255PL_ALWAYS_INLINE
bool operator!=(T* lhs,
const plUniquePtr<T>& rhs)
257 return lhs != rhs.
Borrow();
Base class for all memory allocators.
Definition Allocator.h:23
A Unique ptr manages an object and destroys that object when it goes out of scope....
Definition UniquePtr.h:10
void Clear()
Destroys the managed object and resets the unique ptr.
Definition UniquePtr_inl.h:108
T & operator*() const
Provides access to the managed object.
Definition UniquePtr_inl.h:120
T * Release()
Releases the managed object without destroying it. The unique ptr will be empty afterwards.
Definition UniquePtr_inl.h:79
~plUniquePtr()
Destroys the managed object using the stored allocator.
Definition UniquePtr_inl.h:38
T * operator->() const
Provides access to the managed object.
Definition UniquePtr_inl.h:126
bool operator==(const plUniquePtr< T > &rhs) const
Compares the unique ptr against another unique ptr.
Definition UniquePtr_inl.h:138
T * Borrow() const
Borrows the managed object. The unique ptr stays unmodified.
Definition UniquePtr_inl.h:102
plUniquePtr< T > & operator=(const plInternal::NewInstance< U > &instance)
Sets the unique ptr from a freshly created instance through PL_NEW or PL_DEFAULT_NEW.
Definition Allocator_inl.h:18