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

arg::deep_copy_ptr Class Reference

A "Smart pointer" that takes ownership of the referenced object and implements copy construction/assignment by copying the referenced object. More...

#include <arg_deep_copy.h>

List of all members.


Public Members

 deep_copy_ptr ()
"0 initialised" pointer.

explicit deep_copy_ptr (pointee_type* p) throw ()
Takes ownership of p.

 deep_copy_ptr (const deep_copy_ptr& rhs)
Creates a "deep copy" of rhs.

 ~deep_copy_ptr () throw ()
pointee_type* get () const
Returns contents.

pointee_type* operator-> () const
Indirection operator.

pointee_type& operator * () const
Dereference operator.

deep_copy_ptr& operator= (const deep_copy_ptr& rhs)
Becomes a "deep copy" of rhs.

pointee_type* release ()
Release ownership (and becomes 0).

void reset (pointee_type* p) throw ()
Delete existing contents (and take ownership of p).

void swap (deep_copy_ptr& with) throw ()
Swaps contents with "with".


Detailed Description

template<class pointee_type> class arg::deep_copy_ptr

A "Smart pointer" that takes ownership of the referenced object and implements copy construction/assignment by copying the referenced object.

The correct algorithm for copying is resolved by using the arg::deep_copy() template. This means that the referenced object will be copied using the copy construction unless it is tagged by inheriting from arg::cloneable or an overload of arg::deep_copy() is provided.

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<class pointee_type>
arg::deep_copy_ptr<pointee_type>::deep_copy_ptr<pointee_type> () [inline]

"0 initialised" pointer.

template<class pointee_type>
arg::deep_copy_ptr<pointee_type>::deep_copy_ptr<pointee_type> (pointee_type * p) throw () [inline]

Takes ownership of p.

template<class pointee_type>
arg::deep_copy_ptr<pointee_type>::deep_copy_ptr<pointee_type> (const deep_copy_ptr<pointee_type> & rhs) [inline]

Creates a "deep copy" of rhs.

template<class pointee_type>
arg::deep_copy_ptr<pointee_type>::~deep_copy_ptr<pointee_type> () throw () [inline]

template<class pointee_type>
pointee_type * arg::deep_copy_ptr<pointee_type>::get () const

Returns contents.

template<class pointee_type>
pointee_type * arg::deep_copy_ptr<pointee_type>::operator-> () const [inline]

Indirection operator.

template<class pointee_type>
pointee_type & arg::deep_copy_ptr<pointee_type>::operator * () const [inline]

Dereference operator.

template<class pointee_type>
deep_copy_ptr<pointee_type>& arg::deep_copy_ptr<pointee_type>::operator= (const deep_copy_ptr<pointee_type> & rhs) [inline]

Becomes a "deep copy" of rhs.

template<class pointee_type>
pointee_type * arg::deep_copy_ptr<pointee_type>::release () [inline]

Release ownership (and becomes 0).

template<class pointee_type>
void arg::deep_copy_ptr<pointee_type>::reset (pointee_type * p) throw () [inline]

Delete existing contents (and take ownership of p).

template<class pointee_type>
void arg::deep_copy_ptr<pointee_type>::swap (deep_copy_ptr<pointee_type> & with) throw () [inline]

Swaps contents with "with".


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