Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ScopedPtr< T > Class Template Reference

Scoped smart pointer. More...

Public Types

typedef T Type
 

Public Member Functions

 ScopedPtr (T *p=0)
 
 ~ScopedPtr ()
 
T & operator* () const
 
T * operator-> () const
 
T * get () const
 
 operator bool () const
 
void reset (T *p=0)
 

Private Member Functions

 ScopedPtr (const ScopedPtr &)
 
ScopedPtroperator= (const ScopedPtr &)
 
void operator== (const ScopedPtr &) const
 
void operator!= (const ScopedPtr &) const
 

Private Attributes

T * m_ptr
 

Detailed Description

template<class T>
class ScopedPtr< T >

Scoped smart pointer.

Definition at line 75 of file context.cpp.

Member Typedef Documentation

template<class T>
typedef T ScopedPtr< T >::Type

Definition at line 85 of file context.cpp.

Constructor & Destructor Documentation

template<class T>
ScopedPtr< T >::ScopedPtr ( const ScopedPtr< T > &  )
private
template<class T>
ScopedPtr< T >::ScopedPtr ( T *  p = 0)
inlineexplicit

Definition at line 86 of file context.cpp.

86 : m_ptr(p) {}
p
Definition: test.py:223
T * m_ptr
Definition: context.cpp:78
template<class T>
ScopedPtr< T >::~ScopedPtr ( )
inline

Definition at line 87 of file context.cpp.

87 { delete m_ptr; };
T * m_ptr
Definition: context.cpp:78

Member Function Documentation

template<class T>
T* ScopedPtr< T >::get ( ) const
inline

Definition at line 90 of file context.cpp.

90 { return m_ptr; }
T * m_ptr
Definition: context.cpp:78
template<class T>
ScopedPtr< T >::operator bool ( ) const
inline

Definition at line 91 of file context.cpp.

91 { return m_ptr!=0; }
T * m_ptr
Definition: context.cpp:78
template<class T>
void ScopedPtr< T >::operator!= ( const ScopedPtr< T > &  ) const
private
template<class T>
T& ScopedPtr< T >::operator* ( ) const
inline

Definition at line 88 of file context.cpp.

88 { return *m_ptr; }
T * m_ptr
Definition: context.cpp:78
template<class T>
T* ScopedPtr< T >::operator-> ( ) const
inline

Definition at line 89 of file context.cpp.

89 { return m_ptr; }
T * m_ptr
Definition: context.cpp:78
template<class T>
ScopedPtr& ScopedPtr< T >::operator= ( const ScopedPtr< T > &  )
private
template<class T>
void ScopedPtr< T >::operator== ( const ScopedPtr< T > &  ) const
private
template<class T>
void ScopedPtr< T >::reset ( T *  p = 0)
inline

Definition at line 92 of file context.cpp.

92 { if (p!=m_ptr) { delete m_ptr; m_ptr = p; } }
p
Definition: test.py:223
T * m_ptr
Definition: context.cpp:78

Member Data Documentation

template<class T>
T* ScopedPtr< T >::m_ptr
private

Definition at line 78 of file context.cpp.


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