![]() |
Public API Reference |
![]() |
Copy-on-write wrapper for arbitrary types. More...
#include <csutil/cowwrapper.h>
Public Member Functions | |
CowWrapper (const CowWrapper &other) | |
Copy reference to data from other . | |
CowWrapper (const T &other) | |
Create a new wrapper and initialize with other . | |
const T & | operator* () const |
Return a const reference to the contained data. | |
T & | operator* () |
Return a non-const reference to the contained data. | |
const T * | operator-> () const |
Return a const pointer to the contained data. | |
T * | operator-> () |
Return a non-const pointer to the contained data. | |
Static Public Attributes | |
static const size_t | allocSize = sizeof (WrappedData) |
This is the size of the memory block the wrapper internally uses to store the actual data. |
Copy-on-write wrapper for arbitrary types.
_________________________________________ / Instances transparently maintain a \ | reference-counted pointer to the actual | | data; if an instance is copied, merely | | this pointer is copied. | | | | As long as all access to the data is | | constant, the data is shared between | | instances. Only if non-const access is | | requested the data is duplicated. | | | \ The wrapper itself acts like a pointer. / ----------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||
Definition at line 62 of file cowwrapper.h.
CS::CowWrapper< T, MemoryAllocator >::CowWrapper | ( | const CowWrapper< T, MemoryAllocator > & | other | ) | [inline] |
Copy reference to data from other
.
Definition at line 103 of file cowwrapper.h.
CS::CowWrapper< T, MemoryAllocator >::CowWrapper | ( | const T & | other | ) | [inline] |
Create a new wrapper and initialize with other
.
Definition at line 105 of file cowwrapper.h.
const T& CS::CowWrapper< T, MemoryAllocator >::operator* | ( | ) | const [inline] |
Return a const reference to the contained data.
Definition at line 111 of file cowwrapper.h.
T& CS::CowWrapper< T, MemoryAllocator >::operator* | ( | ) | [inline] |
Return a non-const reference to the contained data.
Definition at line 120 of file cowwrapper.h.
const T* CS::CowWrapper< T, MemoryAllocator >::operator-> | ( | ) | const [inline] |
Return a const pointer to the contained data.
Definition at line 130 of file cowwrapper.h.
T* CS::CowWrapper< T, MemoryAllocator >::operator-> | ( | ) | [inline] |
Return a non-const pointer to the contained data.
Definition at line 137 of file cowwrapper.h.
const size_t CS::CowWrapper< T, MemoryAllocator >::allocSize = sizeof (WrappedData) [static] |
This is the size of the memory block the wrapper internally uses to store the actual data.
It is published to make fixed-size allocators possible.
Definition at line 92 of file cowwrapper.h.