Smart Pointer. More...

#include <rshareddata.h>

Public Member Functions

 RSmartPtr (void)
 
 RSmartPtr (C *ptr)
 
 RSmartPtr (const RSmartPtr &ptr)
 
RSmartPtroperator= (const RSmartPtr &ptr)
 
C * operator-> () const
 
C & operator* () const
 
 ~RSmartPtr (void)
 

Private Member Functions

void Init (void)
 

Private Attributes

C * Ptr
 

Detailed Description

template<class C>
class R::RSmartPtr< C >

Smart Pointer.

The RSmartPtr represent a smart pointer of a given type which must inherits from RSharedData.

Template Parameters
CClass pointed. It is an implementation of Scott Meyers proposition in "MORE EFFECTIVE C++".

Constructor & Destructor Documentation

RSmartPtr ( void  )

Default constructor.

RSmartPtr ( C *  ptr)

Constructor.

Parameters
ptrPointer to the object.
RSmartPtr ( const RSmartPtr< C > &  ptr)

Copy constructor.

Parameters
ptrOriginal smart pointer.
~RSmartPtr ( void  )

Destructor.

Member Function Documentation

void Init ( void  )
private

Method called by all constructors.

RSmartPtr& operator= ( const RSmartPtr< C > &  ptr)

Assignment operator.

Parameters
ptrOriginal smart pointer.
C* operator-> ( ) const

The -> operator.

C& operator* ( ) const

The * operator.

Field Documentation

C* Ptr
private

Pointer.