scoped_ptr< T > Class Template Reference

#include <scoped_ptr.hpp>

Public Types

typedef T element_type

Public Member Functions

 scoped_ptr (T *p=0)
 scoped_ptr (std::auto_ptr< T > p)
 ~scoped_ptr ()
void reset (T *p=0)
T & operator* () const
T * operator-> () const
T * get () const
void swap (scoped_ptr &b)

Detailed Description

template<class T>
class scoped_ptr< T >

Definition at line 9 of file scoped_ptr.hpp.


Member Typedef Documentation

template<class T>
typedef T scoped_ptr< T >::element_type

Definition at line 12 of file scoped_ptr.hpp.


Constructor & Destructor Documentation

template<class T>
scoped_ptr< T >::scoped_ptr ( T *  p = 0  )  [inline, explicit]

Definition at line 14 of file scoped_ptr.hpp.

00014                                   : px(p)
00015     {
00016     }

template<class T>
scoped_ptr< T >::scoped_ptr ( std::auto_ptr< T >  p  )  [inline, explicit]

Definition at line 18 of file scoped_ptr.hpp.

00018                                          : px( p.release() )
00019     {
00020     }

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

Definition at line 22 of file scoped_ptr.hpp.

00023     {
00024         delete px;
00025         px = NULL;
00026     }


Member Function Documentation

template<class T>
void scoped_ptr< T >::reset ( T *  p = 0  )  [inline]

Definition at line 28 of file scoped_ptr.hpp.

00029     {
00030         assert(p == 0 || p != px);
00031         this_type(p).swap(*this);
00032     }

template<class T>
T& scoped_ptr< T >::operator* (  )  const [inline]

Definition at line 34 of file scoped_ptr.hpp.

00035     {
00036         assert(px != 0);
00037         return *px;
00038     }

template<class T>
T* scoped_ptr< T >::operator-> (  )  const [inline]

Definition at line 40 of file scoped_ptr.hpp.

00041     {
00042         assert(px != 0);
00043         return px;
00044     }

template<class T>
T* scoped_ptr< T >::get (  )  const [inline]

Definition at line 46 of file scoped_ptr.hpp.

00047     {
00048         return px;
00049     }

template<class T>
void scoped_ptr< T >::swap ( scoped_ptr< T > &  b  )  [inline]

Definition at line 51 of file scoped_ptr.hpp.

00052     {
00053         T *tmp = b.px;
00054         b.px = px;
00055         px = tmp;
00056     }


The documentation for this class was generated from the following file:
Generated on Sun Apr 11 12:23:11 2010 for RenderStack by  doxygen 1.6.3