Boost.Locale
boost::locale::hold_ptr< T > Class Template Reference

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_ptroperator= (const hold_ptr &)=delete
 
 hold_ptr (hold_ptr &&other) noexcept
 
hold_ptroperator= (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.
 

Detailed Description

template<typename T>
class boost::locale::hold_ptr< T >

a smart pointer similar to std::unique_ptr but the underlying object has the same constness as the pointer itself (unlike an ordinary pointer).


The documentation for this class was generated from the following file: