#include <ksharedptr.h>
Public Member Functions | |
TDESharedPtr () | |
TDESharedPtr (T *t) | |
TDESharedPtr (const TDESharedPtr &p) | |
~TDESharedPtr () | |
TDESharedPtr< T > & | operator= (const TDESharedPtr< T > &p) |
TDESharedPtr< T > & | operator= (T *p) |
bool | operator== (const TDESharedPtr< T > &p) const |
bool | operator!= (const TDESharedPtr< T > &p) const |
bool | operator== (const T *p) const |
bool | operator!= (const T *p) const |
bool | operator! () const |
operator T * () const | |
T * | data () |
const T * | data () const |
const T & | operator* () const |
T & | operator* () |
const T * | operator-> () const |
T * | operator-> () |
int | count () const |
Detailed Description
template<class T>
class TDESharedPtr< T >
Can be used to control the lifetime of an object that has derived TDEShared.
As long a someone holds a TDESharedPtr on some TDEShared object it won't become deleted but is deleted once its reference count is 0. This struct emulates C++ pointers virtually perfectly. So just use it like a simple C++ pointer.
TDEShared and TDESharedPtr are preferred over QShared / QSharedPtr since they are more safe.
WARNING: Please note that this class template provides an implicit conversion to T*. Do *not* change this pointer or the pointee (don't call delete on it, for instance) behind TDESharedPtr's back.
Definition at line 100 of file ksharedptr.h.
Constructor & Destructor Documentation
TDESharedPtr< T >::TDESharedPtr | ( | ) | [inline] |
Creates a null pointer.
Definition at line 106 of file ksharedptr.h.
TDESharedPtr< T >::TDESharedPtr | ( | T * | t | ) | [inline] |
TDESharedPtr< T >::TDESharedPtr | ( | const TDESharedPtr< T > & | p | ) | [inline] |
TDESharedPtr< T >::~TDESharedPtr | ( | ) | [inline] |
Unreferences the object that this pointer points to.
If it was the last reference, the object will be deleted.
Definition at line 126 of file ksharedptr.h.
Member Function Documentation
int TDESharedPtr< T >::count | ( | ) | const [inline] |
Returns the number of references.
- Returns:
- the number of references
Definition at line 170 of file ksharedptr.h.
T* TDESharedPtr< T >::data | ( | ) | [inline] |
const T* TDESharedPtr< T >::data | ( | ) | const [inline] |
The documentation for this class was generated from the following file: