31 template <
typename T = Object>
60 template <
typename NonT>
86 return (_ptr ==
nullptr);
106 if (_owner)
delete _ptr;
124 set(T* ptr,
bool owner =
true)
128 if (_owner)
delete _ptr;
135 template <
typename NonT>
139 set(
dynamic_cast<T*
>(ptr), owner);
155 template <
typename NonT>
171 template <
typename NonT>
186 template <
typename NonT>
236 if (_owner)
delete _ptr;
246 template <
typename X,
typename Y>
249 return (lhs.
get() == rhs.
get());
252 template <
typename T>
255 return (lhs.
get() ==
nullptr);
258 template <
typename T>
261 return (rhs.
get() ==
nullptr);
264 template <
typename X,
typename Y>
267 return (lhs.
get() != rhs.
get());
270 template <
typename T>
273 return (lhs.
get() !=
nullptr);
276 template <
typename T>
279 return (rhs.
get() !=
nullptr);
void stealNonT(AutoPtr< NonT > &rhs)
Steal from AutoPtr<NonT>.
void deInit()
De-initialize UTL++.
void setNonT(NonT *ptr, bool owner=true)
Set new pointer and ownership flag.
void clear()
Delete the pointee if the owner flag is true.
T & operator*() const
Pointer dereference operator.
AutoPtr(AutoPtr< T > &&rhs) noexcept
Move constructor (moving AutoPtr<T>).
T * operator->() const
Member access operator.
AutoPtr< T > & operator=(T *ptr)
Assignment operator from T*.
void steal(AutoPtr< T > &rhs)
Steal from AutoPtr<T>.
AutoPtr(T *ptr, bool owner=true)
Constructor.
AutoPtr< T > & operator=(NonT *ptr)
Assignment operator from NonT*.
T * get() const
Get the pointer.
AutoPtr< T > & operator=(const AutoPtr< NonT > &&rhs) noexcept
Move assignment from AutoPtr<NonT>.
AutoPtr(AutoPtr< NonT > &&rhs) noexcept
Move constructor (moving AutoPtr<NonT>).
bool isNull() const
Determine whether the pointer is nullptr.
bool isOwner() const
Get owner flag.
AutoPtr< T > & operator=(AutoPtr< T > &&rhs) noexcept
Move assignment from AutoPtr<T>.
T * release()
Release ownership (while keeping the pointer).
A "smart" pointer that can also be dumb.
void init()
Initialize UTL++.
#define ASSERTD
Do an assertion in DEBUG mode only.