a smart pointer similar to std::auto_ptr but it is non-copyable and the underlying object has the same constness as the pointer itself (unlike an ordinary pointer). More...
#include <hold_ptr.hpp>
Public Member Functions | |
hold_ptr () | |
Create new empty pointer. More... | |
hold_ptr (T *v) | |
Create a pointer that holds v, ownership is transferred to smart pointer. More... | |
~hold_ptr () | |
Destroy smart pointer and the object it owns. More... | |
T const * | get () const |
Get a const pointer to the object. More... | |
T * | get () |
Get a mutable pointer to the object. More... | |
T const & | operator* () const |
Get a const reference to the object. More... | |
T & | operator* () |
Get a mutable reference to the object. More... | |
T const * | operator-> () const |
Get a const pointer to the object. More... | |
T * | operator-> () |
Get a mutable pointer to the object. More... | |
T * | release () |
Transfer an ownership on the pointer to user. More... | |
void | reset (T *p=0) |
Set new value to pointer, previous object is destroyed, ownership on new object is transferred. More... | |
void | swap (hold_ptr &other) |
Swap two pointers. More... | |
a smart pointer similar to std::auto_ptr but it is non-copyable and the underlying object has the same constness as the pointer itself (unlike an ordinary pointer).
|
inline |
Create new empty pointer.
|
inlineexplicit |
Create a pointer that holds v, ownership is transferred to smart pointer.
|
inline |
Destroy smart pointer and the object it owns.
|
inline |
Get a const pointer to the object.
|
inline |
Get a mutable pointer to the object.
|
inline |
Get a const reference to the object.
|
inline |
Get a mutable reference to the object.
|
inline |
Get a const pointer to the object.
|
inline |
Get a mutable pointer to the object.
|
inline |
Transfer an ownership on the pointer to user.
|
inline |
Set new value to pointer, previous object is destroyed, ownership on new object is transferred.
|
inline |
Swap two pointers.