WriteBuffer.opDollar

class WriteBuffer
@property const pure nothrow @safe @nogc
size_t
opDollar
()

Return Value

Type: size_t

Length of available data.

Examples

auto b = defaultAllocator.make!WriteBuffer(4);
ubyte[3] buf = [48, 23, 255];

b ~= buf;
assert(b.length == 3);
b += 2;
assert(b.length == 1);

b ~= buf;
assert(b.length == 2);
b += 2;
assert(b.length == 2);

b ~= buf;
assert(b.length == 5);
b += b.length;
assert(b.length == 0);

defaultAllocator.dispose(b);

Meta