CyclicArray

@nogc array without memory management using a cyclic array internally Should be treated like a static array when no len is set (copies on assignment) The maximum capacity is static and by default so many elements that it fills at most 4KiB, but at least 8 elements (even if that is more than 4KiB). Set length to 0 to make it a std.container.Array based array

Constructors

this
this()
Undocumented in source.
this
this(Array!T array)
Undocumented in source.
this
this(size_t length)
Undocumented in source.
this
this(T[n] val)
Undocumented in source.
this
this(Range val)
Undocumented in source.
this
this(Args val)
Undocumented in source.
this
this(T[n] val)
Undocumented in source.
this
this(Range val)
Undocumented in source.
this
this(Args val)
Undocumented in source.

Members

Functions

byRef
CyclicRange!T byRef()
Undocumented in source. Be warned that the author may not have intended to support it.
clear
void clear()
Undocumented in source. Be warned that the author may not have intended to support it.
dup
CyclicArray!(T, len) dup()
Undocumented in source. Be warned that the author may not have intended to support it.
dup
CyclicArray!(T, len) dup()
Undocumented in source. Be warned that the author may not have intended to support it.
length
size_t length()
Undocumented in source. Be warned that the author may not have intended to support it.
length
size_t length(size_t val)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(ref T) @(nogc) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(size_t, ref T) @(nogc) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinary
auto opBinary(T rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinary
auto opBinary(T[n] rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinary
auto opBinary(Range rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(CyclicArray!(T, len) b)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(T[n] b)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Range b)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
void opOpAssign(T rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
void opOpAssign(T[n] rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
void opOpAssign(CyclicArray!(T, n) rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
void opOpAssign(Range rhs)
Undocumented in source. Be warned that the author may not have intended to support it.

Mixins

__anonymous
mixin CyclicRangePrimitives!(T, q{ static if (len == 0) auto copy = typeof(cast() this)(array.length); else typeof(cast() this) copy; })
Undocumented in source.

Bugs

foreach with ref value requires @nogc body to make this @nogc compatible

Examples

CyclicArray!int array;
assert(array.length == 0);
array ~= 5;
assert(!array.empty);
assert(array.front == 5);
assert(array[0] == 5);
array ~= [4, 3];

assert(array == [5, 4, 3]);

// same efficiency as insertBack/put/concat
array.insertFront(5);

Meta