WriteBuffer.opDollar

Note that $(D_PSYMBOL length) doesn't return the real length of the data, but only the array length that will be returned with $(D_PSYMBOL opIndex) next time. Be sure to call $(D_PSYMBOL opIndex) and set $(D_KEYWORD +=) until $(D_PSYMBOL length) returns 0.

  1. size_t length [@property getter]
  2. alias opDollar = length
    struct WriteBuffer(T = ubyte)
    alias opDollar = length

Return Value

Data size.

Examples

auto b = WriteBuffer!ubyte(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);

Meta