#include <arg_shared.h>
Class diagram for arg::counted_ptr:
Public Members | |||
counted_ptr () | |||
"0 initialised" pointer. | |||
explicit | counted_ptr (pointee_type* p) | ||
Takes ownership of p. | |||
counted_ptr (const counted_ptr& rhs) | |||
Take value of rhs. | |||
counted_ptr (const base_type& rhs) | |||
Acquire share of ownership from rhs. | |||
~counted_ptr () throw () | |||
pointee_type* | get () const | ||
Returns contents. | |||
pointee_type* | operator-> () const | ||
Indirection operator. | |||
pointee_type& | operator * () const | ||
Dereference operator. | |||
counted_ptr& | operator= (const base_type& rhs) | ||
Acquire share of ownership from rhs (and destroy old referent if last owner). | |||
counted_ptr& | operator= (const counted_ptr& 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". |
"counted_ptr" gives non-intrusive strong reference counting and is copy compatable with "uncounted_ptr" (which gives weak reference counting).
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::counted_ptr<pointee_type>::counted_ptr<pointee_type> () |
"0 initialised" pointer.
template<typename pointee_type> explicit arg::counted_ptr<pointee_type>::counted_ptr<pointee_type> (pointee_type * p) |
Takes ownership of p.
template<typename pointee_type> arg::counted_ptr<pointee_type>::counted_ptr<pointee_type> (const counted_ptr<pointee_type> & rhs) |
Take value of rhs.
template<typename pointee_type> arg::counted_ptr<pointee_type>::counted_ptr<pointee_type> (const base_type & rhs) |
Acquire share of ownership from rhs.
template<typename pointee_type> arg::counted_ptr<pointee_type>::~counted_ptr<pointee_type> () throw () [inline]
|
template<typename pointee_type> pointee_type * arg::counted_ptr<pointee_type>::get () const [inline]
|
template<typename pointee_type> pointee_type * arg::counted_ptr<pointee_type>::operator-> () const [inline]
|
Indirection operator.
template<typename pointee_type> pointee_type & arg::counted_ptr<pointee_type>::operator * () const [inline]
|
Dereference operator.
template<typename pointee_type> counted_ptr<pointee_type> & arg::counted_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> counted_ptr<pointee_type> & arg::counted_ptr<pointee_type>::operator= (const counted_ptr<pointee_type> & rhs) [inline]
|
Acquire share of ownership from rhs (and destroy old referent if last owner).
template<typename pointee_type> void arg::counted_ptr<pointee_type>::reset (pointee_type * p) [inline]
|
Delete existing contents (and take ownership of p).
template<typename pointee_type> void arg::counted_ptr<pointee_type>::swap (base_type & with) throw () [inline]
|
Swaps contents with "with".