Proud::CHeldPtr< T > Class Template Reference

Public Member Functions

 CHeldPtr (T *p_)
 
CHeldPtroperator= (T *p_)
 
void Free ()
 
void Attach (T *p_)
 
void Detach ()
 
 operator T * () const
 
T * get () const
 
T * operator-> () const
 

Public Attributes

T * m_p
 

Detailed Description

template<typename T>
class Proud::CHeldPtr< T >

A less smart pointer that does not count reference count

  • Acts as ATL CAutoPtr
  • When this object is destructed, the object of the pointer that is held by this object is deleted.

Member Function Documentation

template<typename T >
void Proud::CHeldPtr< T >::Attach ( T *  p_)
inline

Attach an object

  • If something else is already attached, do not delete it.
    Parameters
    p_Pointer of the object to be attached.
template<typename T >
void Proud::CHeldPtr< T >::Detach ( )
inline

Detach an object. In other words, the object being held is set to null.

  • Do not delete the previously attached object.
  • In other words, it performs the same role as Attach (NULL).
template<typename T >
void Proud::CHeldPtr< T >::Free ( )
inline

Remove an object.