31 using element_type = T;
37 constexpr
ProPtr() noexcept : _data(
nullptr), _own(false) {}
42 constexpr
ProPtr(std::nullptr_t) noexcept : _data(
nullptr), _own(false) {}
51 explicit ProPtr(pointer p,
bool own =
false) noexcept : _data(p), _own(own)
73 auto owning = pro.
owns();
120 auto owning = pro.
owns();
132 pointer result =
nullptr;
145 void reset(pointer p = pointer(),
bool own =
false) noexcept
160 swap(pro._data, _data);
161 swap(pro._own, _own);
167 pointer
get()
const noexcept
175 explicit operator bool() const noexcept
183 typename std::add_lvalue_reference<T>::type
operator*()
const ~ProPtr()
Desctructor.
Definition: Memory.h:83
void reset(pointer p=pointer(), bool own=false) noexcept
Reset the ProPtr.
Definition: Memory.h:145
A potentially resource owning pointer.
Definition: Memory.h:27
std::add_lvalue_reference< T >::type operator*() const
Return the data being pointed to.
Definition: Memory.h:183
constexpr ProPtr(std::nullptr_t) noexcept
Construct from nullptr_t.
Definition: Memory.h:42
ProPtr & operator=(const ProPtr &pro)=delete
Non-copyable.
ProPtr & operator=(ProPtr &&pro) noexcept
Move assignment operator.
Definition: Memory.h:108
constexpr ProPtr() noexcept
Default constructor.
Definition: Memory.h:37
pointer operator->() const noexcept
Return the raw pointer.
Definition: Memory.h:191
ProPtr(ProPtr< U > &&pro) noexcept
Move construct from a derived type.
Definition: Memory.h:71
ProPtr(pointer p, bool own=false) noexcept
Construct from pointer.
Definition: Memory.h:51
void swap(ProPtr &pro) noexcept
Swap this ProPtr with another, both resource and ownership.
Definition: Memory.h:157
ProPtr(ProPtr &&pro) noexcept
Move constructor.
Definition: Memory.h:62
pointer release() noexcept
Release the ownership(if owns) and return the data.
Definition: Memory.h:130
bool owns() const noexcept
Return whether this pointer owns the resource.
Definition: Memory.h:199
ProPtr & operator=(ProPtr< U > &&pro) noexcept
Move assignment from a derived type.
Definition: Memory.h:118
void swap(ProPtr< T > &lhs, ProPtr< T > &rhs)
Swap contents of two ProPtr<T>s.
Definition: Memory.h:213
ProPtr & operator=(std::nullptr_t) noexcept
Copy assignment from nullptr.
Definition: Memory.h:99