GrowingContainer

A container of primitives of type T that automatically grows when necessary. The size parameter is the growth size

Constructors

this
this(GrowingContainer!(T, size, Allocator) rhs)

Copying is disabled

Destructor

~this
~this()
Undocumented in source.

Members

Functions

opAssign
void opAssign(GrowingContainer!(T, size, Allocator) rhs)

Assigning to is disabled

opIndex
auto opIndex(size_t index)

Accesses element at index index

put
void put(T val)

Put a new element val into the container

reset
void reset()

Reset the current container to zero. Doesn't deallocate memory

Properties

capacity
size_t capacity [@property getter]

Returns container's internal capacity

get
T[] get [@property getter]

Returns primitives as an array

getPartial
T[] getPartial [@property getter]

Returns a slice of T[] that only has count primitives in it

length
size_t length [@property getter]

Returns count of elements in this container

Examples

GrowingContainer!(int, 10) container;
assert(container.capacity == 0);
container.put(10);
assert(container.capacity == 10 && container.length == 1);
foreach(i; 0 .. 10)
    container.put(i);
assert(container.capacity == 20 && container.length == 11);
assert(container[1] == 0 && container[0] == 10);

Meta