#include <arg_shared.h>
Class diagram for arg::uncounted_ptr:
Public Members | |||
uncounted_ptr () | |||
"0 initialised" pointer. | |||
uncounted_ptr (const base_type& rhs) | |||
Acquire share of ownership from rhs. | |||
~uncounted_ptr () throw () | |||
pointee_type* | get () const | ||
Returns contents. | |||
pointee_type* | operator-> () const | ||
Indirection operator. | |||
pointee_type& | operator * () const | ||
Dereference operator. | |||
uncounted_ptr& | operator= (const base_type& rhs) | ||
Acquire share of ownership from rhs (and destroy old referent if last owner). | |||
void | reset (pointee_type* p) | ||
Delete existing contents (and take ownership of p). | |||
void | swap (base_type& with) throw () | ||
Swaps contents with "with". |
When there are no owners of the referenced object the pointer becomes zero.
The copy semantics are to copy the reference - "uncounted_ptr" gives weak reference counting (the references do not participate in the ownership) and is copy compatable with "counted_ptr".
counted_ptr
and uncounted_ptr
are described in an article:
Uncounted pointers in C++.
All methods support the strong exception safety guarantee with the proviso that the referenced type must have a non-throwing destructor.
template<typename pointee_type> arg::uncounted_ptr<pointee_type>::uncounted_ptr<pointee_type> () |
"0 initialised" pointer.
template<typename pointee_type> arg::uncounted_ptr<pointee_type>::uncounted_ptr<pointee_type> (const base_type & rhs) |
Acquire share of ownership from rhs.
template<typename pointee_type> arg::uncounted_ptr<pointee_type>::~uncounted_ptr<pointee_type> () throw () [inline]
|
template<typename pointee_type> pointee_type * arg::uncounted_ptr<pointee_type>::get () const [inline]
|
template<typename pointee_type> pointee_type * arg::uncounted_ptr<pointee_type>::operator-> () const [inline]
|
Indirection operator.
template<typename pointee_type> pointee_type & arg::uncounted_ptr<pointee_type>::operator * () const [inline]
|
Dereference operator.
template<typename pointee_type> uncounted_ptr<pointee_type> & arg::uncounted_ptr<pointee_type>::operator= (const base_type & rhs) [inline]
|
Acquire share of ownership from rhs (and destroy old referent if last owner).
template<typename pointee_type> void arg::uncounted_ptr<pointee_type>::reset (pointee_type * p) [inline]
|
Delete existing contents (and take ownership of p).
template<typename pointee_type> void arg::uncounted_ptr<pointee_type>::swap (base_type & with) throw () [inline]
|
Swaps contents with "with".