Struct AllocatedBuffer

Array based buffer manager. Uses custom allocator to get the data. Limits growth to doubling.

struct AllocatedBuffer(T, Allocator, ulong floorSize = 8192) ;

Constructors

NameDescription
this (alloc) Construct a buffer manager with a given allocator.

Fields

NameTypeDescription
_allocator AllocatorConstruct a buffer manager with a given allocator.

Properties

NameTypeDescription
allocator[get] AllocatorConstruct a buffer manager with a given allocator.

Methods

NameDescription
avail ()
capacity ()
extend (request) Add more data to the window of currently valid data. To avoid expensive reallocation, use avail to tune this call.
releaseBack (elements) Give bytes back to the buffer manager from the back of the buffer. These bytes can be removed in this operation or further operations and should no longer be used.
releaseFront (elements) Give bytes back to the buffer manager from the front of the buffer. These bytes can be removed in this operation or further operations and should no longer be used.
window () The window of currently valid data

Parameters

NameDescription
T The type of the elements the buffer will use
Allocator The allocator to use for adding more elements
floorSize The size that can be freely allocated before growth is restricted to 2x. Based on concept by Dmitry Olshansky