ztsdb
Public Member Functions | List of all members
arr::cow_ptr< T > Struct Template Reference

#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_ptroperator= (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
 

Detailed Description

template<typename T>
struct arr::cow_ptr< T >

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.

Member Function Documentation

◆ get() [1/2]

template<typename T >
T* arr::cow_ptr< T >::get ( )
inline

Get a regular pointer to the object without increasing the count of p.

◆ get() [2/2]

template<typename T >
const T* arr::cow_ptr< T >::get ( ) const
inline

Get a regular const pointer to the object without increasing the count of p.


The documentation for this struct was generated from the following file: