SmallBuffer

Defines a temporary array of Elements using a fixed-length buffer as back store. If the length of the buffer suffices, it is readily used. Otherwise, malloc is used to allocate memory for the array and free is used for deallocation in the destructor.

This type is meant to use exclusively as an automatic variable. It is not default constructible or copyable.

Constructors

this
this(size_t len, Element[] buffer)

Construct a SmallBuffer

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Alias This

extent

Members

Functions

create
void create(size_t len)

Resize existing SmallBuffer.

Examples

ditto

char[230] buf = void;
auto a = SmallBuffer!char(10, buf);
assert(a[] is buf[0 .. 10]);
auto b = SmallBuffer!char(1000, buf);
assert(b[] !is buf[]);
b.create(1000);
assert(b.length == 1000);
assert(b[] !is buf[]);

Meta