StaticRingBuffer

@nogc @safe ringbuffer using static memory block

Members

Functions

opIndex
auto ref opIndex(size_t idx)

random access operator

opOpAssign
auto ref opOpAssign(T v)

append operator

Manifest constants

StaticSize
enum StaticSize;

Properties

length
size_t length [@property getter]

current amount of elements used in the buffer

ptr
T* ptr [@property getter]

Examples

t
{
	StaticRingBuffer!(2, int) foo;
	assert(foo.length == 0);

	foo ~= 1;

	assert(foo.length == 1);
	assert(foo[0] == 1);

	foo ~= 2;

	assert(foo.length == 2);
	assert(foo[0] == 1);
	assert(foo[1] == 2);

	foo ~= 3;

	assert(foo.length == 2);
	assert(foo[0] == 2);
	assert(foo[1] == 3

Meta