ScopedBuffer

Destructor

~this
~this()

Postblit

this(this)
this(this)

Copy constructor is enabled only if T is mutable type without eleborate assign.

Members

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)
put
void put(T e)
put
void put(R e)
put
void put(R[] e)
put
void put(Iterable range)
reset
void reset()
shrinkTo
void shrinkTo(size_t length)

Variables

_scopeBufferPayload
ubyte[_bufferLength * T.sizeof] _scopeBufferPayload;
Undocumented in source.

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