Boost.Locale
|
a smart pointer similar to std::unique_ptr but the underlying object has the same constness as the pointer itself (unlike an ordinary pointer). More...
#include <boost/locale/hold_ptr.hpp>
Public Member Functions | |
hold_ptr () | |
Create new empty pointer. | |
hold_ptr (T *v) | |
Create a pointer that holds v, ownership is transferred to smart pointer. | |
~hold_ptr () | |
Destroy smart pointer and the object it owns. | |
hold_ptr (const hold_ptr &)=delete | |
hold_ptr & | operator= (const hold_ptr &)=delete |
hold_ptr (hold_ptr &&other) noexcept | |
hold_ptr & | operator= (hold_ptr &&other) noexcept |
T const * | get () const |
Get a const pointer to the object. | |
T * | get () |
Get a mutable pointer to the object. | |
operator bool () const | |
Explicitly convertible to bool. Returns: get() != nullptr. | |
T const & | operator * () const |
Get a const reference to the object. | |
T & | operator * () |
Get a mutable reference to the object. | |
T const * | operator-> () const |
Get a const pointer to the object. | |
T * | operator-> () |
Get a mutable pointer to the object. | |
T * | release () |
Transfer an ownership on the pointer to user. | |
void | reset (T *p=nullptr) |
Set new value to pointer, previous object is destroyed, ownership on new object is transferred. | |
void | swap (hold_ptr &other) |
Swap two pointers. | |
a smart pointer similar to std::unique_ptr but the underlying object has the same constness as the pointer itself (unlike an ordinary pointer).