The OpenD Programming Language

ScopedBuffer

The buffer uses stack memory and C Runtime to allocate temporal memory.

Shouldn't store references to GC allocated data.

Destructor

~this
~this()

Postblit

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

Members

Aliases

opOpAssign
alias opOpAssign(string op : "~") = put

Functions

data
inout(T)[] data()
initialize
void initialize()
length
size_t length()
moveDataAndEmplaceTo
void moveDataAndEmplaceTo(T[] array)

Copies data into an array of the same length using memcpy C routine. Shrinks the length to 0.

popBackN
void popBackN(size_t n)
prepare
T[] prepare(size_t n)

Return a slice to n more elements.

put
void put(T e)
put
void put(R e)
put
void put(R[] e)
put
void put(Iterable range)
reserve
void reserve(size_t n)

Reserve n more elements.

reset
void reset()
shrinkTo
void shrinkTo(size_t length)

Examples

auto buf = scopedBuffer!char;
buf.put('c');
buf.put("str");
assert(buf.data == "cstr");

buf.popBackN(2);
assert(buf.data == "cs");

immutable

auto buf = scopedBuffer!(immutable char);
buf.put('c');
buf.put("str");
assert(buf.data == "cstr");

buf.popBackN(2);
assert(buf.data == "cs");

Meta