sprint 1-alpha
Public Member Functions
sprint::shared_ptr< T > Class Template Reference

an intrusive shared_ptr implementation. More...

#include <shared_ptr.h>

List of all members.

Public Member Functions

 shared_ptr (T *obj)
 create a shared_ptr from an object. Increare reference count
 shared_ptr (const shared_ptr< T > &obj)
 create a shared_ptr from a shared_ptr. Increare reference count
template<class R >
 shared_ptr (const shared_ptr< R > &obj)
 create a shared_ptr from a shared_ptr. Increare reference count
 ~shared_ptr ()
 release shared_ptr
shared_ptroperator= (const shared_ptr< T > &a)
T & operator* () const
T * operator-> () const
T * get () const
int use_count () const
 for debug purpose returns the current reference count
void swap (shared_ptr &b)

Detailed Description

template<class T>
class sprint::shared_ptr< T >

an intrusive shared_ptr implementation.

Class T should have a m_refCount member (for example using sprint::sharable) in order to use sprint::shared_ptr. With this approach class have access to reference count and can switch between shared_ptr and pointer without restrictions. this class have the same size of an auto_ptr o a pointer, no heap fragmentation and waste, time to access to pointer is the same of a standard pointer. To help class development sprint::sharable object should be used.

  sprint::shared_ptr<MyClass> p(new MyClass);
Note:
if T is a vector use shared_vector instead

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines