GiNaC  1.6.2
Public Member Functions | Private Attributes | Friends
GiNaC::ptr< T > Class Template Reference

Class of (intrusively) reference-counted pointers that support copy-on-write semantics. More...

#include <ptr.h>

List of all members.

Public Member Functions

 ptr (T *t) throw ()
 Bind ptr to newly created object, start reference counting.
 ptr (T &t) throw ()
 Bind ptr to existing reference-counted object.
 ptr (const ptr &other) throw ()
 ~ptr ()
ptroperator= (const ptr &other)
T & operator* () const throw ()
T * operator-> () const throw ()
void makewritable ()
 Announce your intention to modify the object bound to this ptr.
void swap (ptr &other) throw ()
 Swap the bound object of this ptr with another ptr.
template<class U >
bool operator== (const ptr< U > &rhs) const throw ()
template<class U >
bool operator!= (const ptr< U > &rhs) const throw ()

Private Attributes

T * p

Friends

class std::less< ptr< T > >
T * get_pointer (const ptr &x) throw ()
template<class U >
bool operator== (const ptr &lhs, const U *rhs) throw ()
template<class U >
bool operator!= (const ptr &lhs, const U *rhs) throw ()
template<class U >
bool operator== (const U *lhs, const ptr &rhs) throw ()
template<class U >
bool operator!= (const U *lhs, const ptr &rhs) throw ()
std::ostream & operator<< (std::ostream &os, const ptr< T > &rhs)

Detailed Description

template<class T>
class GiNaC::ptr< T >

Class of (intrusively) reference-counted pointers that support copy-on-write semantics.

Requirements for T: must support the refcounted interface (usually by being derived from refcounted) T* T::duplicate() member function (only if makewriteable() is used)

Definition at line 56 of file ptr.h.


Constructor & Destructor Documentation

template<class T>
GiNaC::ptr< T >::ptr ( T *  t) throw () [inline]

Bind ptr to newly created object, start reference counting.

Definition at line 67 of file ptr.h.

template<class T>
GiNaC::ptr< T >::ptr ( T &  t) throw () [inline, explicit]

Bind ptr to existing reference-counted object.

Definition at line 70 of file ptr.h.

template<class T>
GiNaC::ptr< T >::ptr ( const ptr< T > &  other) throw () [inline]

Definition at line 72 of file ptr.h.

template<class T>
GiNaC::ptr< T >::~ptr ( ) [inline]

Definition at line 74 of file ptr.h.


Member Function Documentation

template<class T>
ptr& GiNaC::ptr< T >::operator= ( const ptr< T > &  other) [inline]

Definition at line 80 of file ptr.h.

template<class T>
T& GiNaC::ptr< T >::operator* ( ) const throw () [inline]

Definition at line 93 of file ptr.h.

template<class T>
T* GiNaC::ptr< T >::operator-> ( ) const throw () [inline]

Definition at line 94 of file ptr.h.

template<class T>
void GiNaC::ptr< T >::makewritable ( ) [inline]

Announce your intention to modify the object bound to this ptr.

This ensures that the object is not shared by any other ptrs.

Definition at line 100 of file ptr.h.

Referenced by GiNaC::ex::makewriteable().

template<class T>
void GiNaC::ptr< T >::swap ( ptr< T > &  other) throw () [inline]

Swap the bound object of this ptr with another ptr.

Definition at line 111 of file ptr.h.

Referenced by GiNaC::ex::swap().

template<class T>
template<class U >
bool GiNaC::ptr< T >::operator== ( const ptr< U > &  rhs) const throw () [inline]

Definition at line 124 of file ptr.h.

template<class T>
template<class U >
bool GiNaC::ptr< T >::operator!= ( const ptr< U > &  rhs) const throw () [inline]

Definition at line 127 of file ptr.h.


Friends And Related Function Documentation

template<class T>
friend class std::less< ptr< T > > [friend]

Definition at line 57 of file ptr.h.

template<class T>
T* get_pointer ( const ptr< T > &  x) throw () [friend]

Definition at line 96 of file ptr.h.

Referenced by GiNaC::ptr< basic >::operator!=(), and GiNaC::ptr< basic >::operator==().

template<class T>
template<class U >
bool operator== ( const ptr< T > &  lhs,
const U *  rhs 
) throw () [friend]

Definition at line 130 of file ptr.h.

template<class T>
template<class U >
bool operator!= ( const ptr< T > &  lhs,
const U *  rhs 
) throw () [friend]

Definition at line 133 of file ptr.h.

template<class T>
template<class U >
bool operator== ( const U *  lhs,
const ptr< T > &  rhs 
) throw () [friend]

Definition at line 136 of file ptr.h.

template<class T>
template<class U >
bool operator!= ( const U *  lhs,
const ptr< T > &  rhs 
) throw () [friend]

Definition at line 139 of file ptr.h.

template<class T>
std::ostream& operator<< ( std::ostream &  os,
const ptr< T > &  rhs 
) [friend]

Definition at line 141 of file ptr.h.


Member Data Documentation

template<class T>
T* GiNaC::ptr< T >::p [private]

The documentation for this class was generated from the following file:

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.