trikRuntime
|
Smart pointer that can hold two different kinds of pointers: where ownership belongs to someone else and where ownership belongs to this object (some mix of shared pointer and weak pointer). More...
#include <differentOwnerPointer.h>
Public Member Functions | |
DifferentOwnerPointer (const DifferentOwnerPointer< T > &other) | |
Copy constructor. Preserves ownership semantics of a copied object. More... | |
DifferentOwnerPointer (T &foreignObject) | |
Constructor which takes a reference to object owned by someone else, so we need only to store the reference on it. More... | |
DifferentOwnerPointer (const QSharedPointer< T > &sharedObject) | |
Constructor which takes shared pointer to object and makes DifferentOwnerPointer behave like shared pointer (it is preferred way to pass ownership from object to object to prevent memory leaks if exception will be thrown somewhere before ownership is passed). More... | |
DifferentOwnerPointer (T *const ownObject) | |
Constructor which takes raw pointer and takes ownership over it. More... | |
T * | operator-> () |
Operator that allows to access members of stored object. More... | |
T & | operator* () |
Provides reference to stored object. More... | |
T * | data () const |
Returns raw pointer to an object, does not transfer ownership. More... | |
DifferentOwnerPointer< T > & | operator= (const DifferentOwnerPointer< T > &other)=default |
Assignment operator to provide value semantics. More... | |
Smart pointer that can hold two different kinds of pointers: where ownership belongs to someone else and where ownership belongs to this object (some mix of shared pointer and weak pointer).
Different constructors provide different behavior.
|
inline |
Copy constructor. Preserves ownership semantics of a copied object.
|
inlineexplicit |
Constructor which takes a reference to object owned by someone else, so we need only to store the reference on it.
|
inlineexplicit |
Constructor which takes shared pointer to object and makes DifferentOwnerPointer behave like shared pointer (it is preferred way to pass ownership from object to object to prevent memory leaks if exception will be thrown somewhere before ownership is passed).
|
inlineexplicit |
Constructor which takes raw pointer and takes ownership over it.
|
inline |
Returns raw pointer to an object, does not transfer ownership.
|
inline |
Provides reference to stored object.
|
inline |
Operator that allows to access members of stored object.
|
inlinedefault |
Assignment operator to provide value semantics.