Simple buffer/queue for storing and fetching items of any type T. Does not use manual memory allocation.
Simple circular-ish buffer for storing items of type T that discards elements when the maximum size is reached. Does not use manual memory allocation.
{ Buffer!string buffer; buffer.put("abc"); buffer.put("def"); assert(!buffer.empty); assert(buffer.front == "abc"); buffer.popFront(); assert(buffer.front == "def"); buffer.popFront(); assert(buffer.empty); } { Buffer!(char, Yes.dynamic, 3) buffer; assert(!buffer.buf.length); buffer ~= 'a'; assert(buffer.buf.length == 3); buffer ~= 'b'; buffer ~= 'c'; assert(buffer.length == 3); buffer ~= 'd'; assert(buffer.buf.length > 3); assert(buffer[0..5] == "abcd"); buffer.clear(); assert(buffer.empty); }
Containers and thereto related functionality.