|
|
| smart_ptr () |
| | Default constructor. Initializes with no pointer set.
|
| |
|
| smart_ptr (ptr_type p) |
| | This constructor takes a pointer to the object to be deleted.
|
| |
|
| smart_ptr (smart_ptr< T > &&other) |
| | Move copy constructor.
|
| |
|
smart_ptr< T > & | operator= (smart_ptr< T > &&other) |
| | Move assignment operator.
|
| |
|
smart_ptr< T > & | operator= (ptr_type p) |
| | To allow setting the pointer directly. Equivalent to a call to set().
|
| |
| virtual | ~smart_ptr () |
| |
|
ptr_type | get () |
| | Return the current pointer value.
|
| |
|
const_ptr_type | get () const |
| | Return the const form of the current pointer value.
|
| |
| void | set (ptr_type p) |
| |
|
void | reset () |
| | Dissociates any previously set pointer value without deleting it.
|
| |
|
void | clear () |
| | Dissociates a previously set pointer value, deleting it at the same time.
|
| |
| virtual void | safe_delete () |
| |
|
|
| operator ptr_type () |
| | Makes the object transparent as the template type.
|
| |
|
| operator const_ptr_type () const |
| | Const version of the pointer operator.
|
| |
|
| operator ref_type () |
| | Makes the object transparent as a reference of the template type.
|
| |
|
| operator const_ref_type () const |
| | Const version of the reference operator.
|
| |
|
| operator bool () const |
| | Returns a boolean indicating whether the object has a pointer set or not.
|
| |
|
ptr_type | operator-> () |
| | Another operator to allow you to treat the object just like a pointer.
|
| |
|
const_ptr_type | operator-> () const |
| | Another operator to allow you to treat the object just like a pointer.
|
| |
template<typename T, class delete_policy = smart_ptr_delete<T>>
class smart_ptr< T, delete_policy >
Simple, standard smart pointer class.
This class only supports the single-owner paradigm.
template<typename T , class delete_policy = smart_ptr_delete<T>>
| void smart_ptr< T, delete_policy >::set |
( |
ptr_type |
p | ) |
|
|
inline |
Change the pointer value, or set if if the default constructor was used. If a pointer had previously been associated with the object, and p is different than that previous pointer, it will be deleted before taking ownership of p. If this is not desired, call reset() beforehand.