Free Electron
|
Intrusive Smart Pointer. More...
#include <ptr.h>
Inherited by fe::cp< T >.
Public Member Functions | |
sp (T *pT) | |
sp (const sp< T > &rspT) | |
template<typename X > | |
sp (const sp< X > &rspX) | |
template<typename X > | |
sp (const hp< X > &rhpX) | |
sp< T > & | operator= (T *pT) |
sp< T > & | operator= (const sp< T > &rspT) |
template<typename X > | |
sp< T > & | operator= (const sp< X > &rspX) |
template<typename X > | |
bool | is (void) |
template<typename X > | |
sp< T > & | operator= (const hp< X > &rhpX) |
T & | operator* (void) |
const T & | operator* (void) const |
T * | operator-> (void) const |
const T * | asConst (void) const |
T * | abandon (void) |
T * | raw (void) const |
BWORD | isValid (void) const |
BWORD | isNull (void) const |
Private Member Functions | |
void | track (void) |
void | untrack (void) |
Private Attributes | |
T * | m_tPtr |
Related Functions | |
(Note that these are not member functions.) | |
template<class T , class X > | |
BWORD | operator== (const sp< T > &rspLeft, const sp< X > &rspRight) |
template<class T , class X > | |
BWORD | operator!= (const sp< T > &rspLeft, const sp< X > &rspRight) |
template<class T , class X > | |
BWORD | operator< (const sp< T > &rspLeft, const sp< X > &rspRight) |
Intrusive Smart Pointer.
In the spectrum of "smart" pointers, this is a shared pointer. It is held from several points and let go when all contacts have released it. The elimination of the pointed-to object is left to the object itself. It is presumed that the object holds a reference count which tracks each acquire and release. A common resolution is self-deletion.
For an interchangable weak reference, see hp<>.
FE doesn't currently have direct support for a scoped or auto pointer with just one owner.
The reason this class breaks fe naming convention is for clarity during usage. The short lowercase 'sp' name obscures the pointed-to class less.
Attempt to reference a pointer on the stack is illegal and should cause an exception.
|
related |
|
related |
|
related |