7 #ifndef BOOST_LOCALE_HOLD_PTR_H 8 #define BOOST_LOCALE_HOLD_PTR_H 10 #include <boost/locale/config.hpp> 12 namespace boost {
namespace locale {
31 hold_ptr(
hold_ptr&& other) noexcept : ptr_(other.ptr_) { other.ptr_ =
nullptr; }
39 T
const*
get()
const {
return ptr_; }
41 T*
get() {
return ptr_; }
44 explicit operator bool()
const {
return ptr_ !=
nullptr; }
hold_ptr()
Create new empty pointer.
Definition: hold_ptr.hpp:19
T const * operator->() const
Get a const pointer to the object.
Definition: hold_ptr.hpp:52
T * get()
Get a mutable pointer to the object.
Definition: hold_ptr.hpp:41
T const & operator *() const
Get a const reference to the object.
Definition: hold_ptr.hpp:47
T const * get() const
Get a const pointer to the object.
Definition: hold_ptr.hpp:39
hold_ptr(T *v)
Create a pointer that holds v, ownership is transferred to smart pointer.
Definition: hold_ptr.hpp:22
a smart pointer similar to std::unique_ptr but the underlying object has the same constness as the po...
Definition: hold_ptr.hpp:16
void reset(T *p=nullptr)
Set new value to pointer, previous object is destroyed, ownership on new object is transferred.
Definition: hold_ptr.hpp:65
~hold_ptr()
Destroy smart pointer and the object it owns.
Definition: hold_ptr.hpp:25
T * release()
Transfer an ownership on the pointer to user.
Definition: hold_ptr.hpp:57
void swap(hold_ptr &other)
Swap two pointers.
Definition: hold_ptr.hpp:73
T * operator->()
Get a mutable pointer to the object.
Definition: hold_ptr.hpp:54