Main Page   Namespace List   Class Hierarchy   Compound List   File List   Header Files   Namespace Members   Compound Members   File Members  

arg::uncounted_ptr Class Reference

"Smart pointer" template which does not own the referenced object (a counted_ptr is needed to own the object). More...

#include <arg_shared.h>

Class diagram for arg::uncounted_ptr:

arg::typed_reference arg::generic_reference

List of all members.


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".


Detailed Description

template<typename pointee_type> class arg::uncounted_ptr

"Smart pointer" template which does not own the referenced object (a counted_ptr is needed to own the object).

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.

Author(s):
Alan Griffiths

Member Function Documentation

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]

Returns contents.

Reimplemented from arg::generic_reference.

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".


The documentation for this class was generated from the following file:
Copyright 1999-2000 Alan Griffiths