nub::ref< T > Class Template Reference

#include <nub/ref.h>

Inheritance diagram for nub::ref< T >:

Inheritance graph
Collaboration diagram for nub::ref< T >:

Collaboration graph

List of all members.

Public Member Functions

 ref (nub::uid i)
 ref (T *ptr, ref_vis vis=DEFAULT)
template<class U>
 ref (const ref< U > &other)
template<class U>
 ref (const soft_ref< U > &other)
void reset (T *p)
 Shorthand for assignment.
T * operator-> () const throw ()
T & operator* () const throw ()
T * get () const throw ()
bool operator== (const ref &other) const throw ()
bool operator!= (const ref &other) const throw ()
nub::uid id () const throw ()
bool operator< (const ref &other) const throw ()
 Comparison operator for sorting.

Detailed Description

template<class T>
class nub::ref< T >

nub::ref<T> is a ref-counted smart pointer for holding ref_counted objects. A nub::ref<T> is guaranteed to always point to a valid ref_counted object, and uses ref_counted's strong ref counts to achieve this. In order to provide this guarantee, it is possible that construction of a nub::ref<T> may throw an exception. For example, a nub::ref<T> cannot be constructed for a volatlie ref_counted object for which only weak references are available.

Definition at line 134 of file ref.h.

Member Function Documentation

template<class T>
void nub::ref< T >::reset ( T *  p  )  [inline]

Shorthand for assignment.

Given ref<T> rr and T* p, then rr.reset(p) is shorthand for rr=ref<T>(p). But of course, rr.reset(p) is much less typing if T happens to be spelt SomeLongType<WithTemplateParams>.

Definition at line 166 of file ref.h.

template<class T>
bool nub::ref< T >::operator< ( const ref< T > &  other  )  const throw () [inline]

Comparison operator for sorting.

E.g. to allow insertion into std::map or std::set, etc.

Definition at line 184 of file ref.h.

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

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:56:23 2008 by Doxygen version 1.5.5.