Struct _MemoryResourceSingleChunk

Inheritance Relationships

Base Type

Derived Types

Struct Documentation

struct _MemoryResourceSingleChunk : public c4::detail::DerivedMemoryResource

Provides common facilities for memory resource consisting of a single memory block

Subclassed by c4::MemoryResourceLinear, c4::MemoryResourceStack

Public Types

using impl_type = DerivedMemoryResource

Public Functions

C4_NO_COPY_OR_MOVE(_MemoryResourceSingleChunk)
inline _MemoryResourceSingleChunk(MemoryResource *impl = nullptr)
inline _MemoryResourceSingleChunk(size_t sz, MemoryResource *impl = nullptr)

initialize with owned memory, allocated from the given (or the global) memory resource

inline _MemoryResourceSingleChunk(void *mem, size_t sz)

initialize with borrowed memory

inline virtual ~_MemoryResourceSingleChunk() override
inline void const *mem() const
inline size_t capacity() const
inline size_t size() const
inline size_t slack() const
inline void clear()

set the internal pointer to the beginning of the linear buffer

void acquire(size_t sz)

initialize with owned memory, allocated from the global memory resource

void acquire(void *mem, size_t sz)

initialize with borrowed memory

void release()

release the memory

Public Members

char *m_mem = {nullptr}
size_t m_size = {0}
size_t m_pos = {0}
bool m_owner