#include <OwnershipSPtr.h>
Smart pointer where the user precises if it must take the ownership (and so be in charge of deleting the data). Either it can point to an existing data without taking the ownership or it can point to a new temporary Data that will be deleted when this smart pointer is deleted (taking ownership).
Public Member Functions | |
OwnershipSPtr () | |
default constructor: no pointed data, no ownership More... | |
OwnershipSPtr (const T *t, bool ownership) | |
point to a data, manually set ownership More... | |
OwnershipSPtr (const OwnershipSPtr< T > &other) | |
copy constructor that steals the ownership if 'other' had it More... | |
~OwnershipSPtr () | |
destructor will delete the data only if it has the ownership More... | |
void | operator= (const OwnershipSPtr< T > &other) |
copy operator is stealing the ownership if 'other' had it More... | |
const T & | operator* () const |
get a const ref to the pointed data More... | |
const T * | operator-> () const |
get a const pointer to the pointer data More... | |
|
inline |
default constructor: no pointed data, no ownership
|
inline |
point to a data, manually set ownership
|
inline |
copy constructor that steals the ownership if 'other' had it
|
inline |
destructor will delete the data only if it has the ownership
|
inline |
get a const ref to the pointed data
|
inline |
get a const pointer to the pointer data
|
inline |
copy operator is stealing the ownership if 'other' had it