ROSE
0.11.96.11
|
Creates SharedPointer from this.
This class provides a sharedFromThis method that returns a SharedPointer pointing to an object of type T
. The template parameter T
is usually the name of the class derived from SharedFromThis. For instance, the following example declares MyBaseClass
to be a shared object (able to be pointed to by a SharedPointer), and declares that it is possible to create a SharedPointer from a raw object pointer.
Some method in MyBaseClass
might want to return such a pointer:
Subclasses in a class hierarchy need not all have the same version of sharedFromThis
. If the user's base class is the only one to directly derive from SharedFromThis, then any subclass calling sharedFromThis
will return a pointer to the user's base class. On the other hand, the various subclasses can directly inherit from SharedFromThis also in order to return pointers to objects of their type:
Definition at line 364 of file SharedPointer.h.
#include <SharedPointer.h>
Public Member Functions | |
SharedPointer< T > | sharedFromThis () |
Create a shared pointer from this . More... | |
SharedPointer< const T > | sharedFromThis () const |
Create a shared pointer from this . More... | |
|
inline |
Create a shared pointer from this
.
Returns a shared pointer that points to this object. The type T
must be derived from SharedObject.
Definition at line 373 of file SharedPointer.h.
|
inline |
Create a shared pointer from this
.
Returns a shared pointer that points to this object. The type T
must be derived from SharedObject.
Definition at line 378 of file SharedPointer.h.