ztsdb
|
#include <cow_ptr.hpp>
Public Member Functions | |
cow_ptr (unsigned flags_p, T *t) | |
cow_ptr (unsigned flags_p, std::shared_ptr< T > tp) | |
const T * | operator-> () const |
const T & | operator* () const |
T * | operator-> () |
T & | operator* () |
T * | get () |
const T * | get () const |
cow_ptr & | operator= (const cow_ptr< T > &o) |
cow_ptr (const cow_ptr &o) | |
bool | isRef () const |
bool | isLocked () const |
bool | isConst () const |
bool | isTmp () const |
bool | isLast () const |
void | setTmp () |
void | setRef () |
void | setLock () |
void | setConst () |
void | setLast () |
void | resetTmp () |
void | resetLock () |
void | resetRef () |
unsigned | getFlags () const |
long | use_count () const |
This is a typical copy on write pointer, with the addition that if the nevercopy flag is set, it acts as a regular shared_ptr and no copy is ever made. This allows the implementation of the pass by reference and pass by value semantics of the interpreter. In the end, as this class is just a wrapper for a shared_ptr, all the usual shared pointer semantics apply and memory will be freed as with a shared_ptr.
|
inline |
Get a regular pointer to the object without increasing the count of p.
|
inline |
Get a regular const pointer to the object without increasing the count of p.