Initial release: April 2008
Kris
0.99.7
- struct Vector(V, int Size = 0) ¶
-
A vector of the given value-type V, with maximum depth Size. Note
that this does no memory allocation of its own when Size != 0, and
does heap allocation when Size == 0. Thus you can have a fixed-size
low-overhead instance, or a heap oriented instance.
- Vector* clear() ¶
-
- size_t size() [@property, const] ¶
-
Return depth of the vector
- size_t unused() [const] ¶
-
Return remaining unused slots
- Vector clone() ¶
-
Returns a (shallow) clone of this vector
- V* add(V value) ¶
-
Add a value to the vector.
Throws an exception when the vector is full
- V* add() ¶
-
Add a value to the vector.
Throws an exception when the vector is full
- Vector* append(V[] value...) ¶
-
Add a series of values to the vector.
Throws an exception when the vector is full
- V remove() ¶
-
Remove and return the most recent addition to the vector.
Throws an exception when the vector is empty
- V remove(size_t i) ¶
-
Index vector entries, where a zero index represents the
oldest vector entry.
Throws an exception when the given index is out of range
- V opIndex(size_t i) ¶
-
Index vector entries, as though it were an array
Throws an exception when the given index is out of range
- V opIndexAssign(V value, size_t i) ¶
-
Assign vector entries as though it were an array.
Throws an exception when the given index is out of range
- V[] slice() ¶
-
Return the vector as an array of values, where the first
array entry represents the oldest value.
Doing a foreach() on the returned array will traverse in
the opposite direction of foreach() upon a vector
- int opApply(scope int delegate(ref V value) dg) ¶
-
Iterate from the most recent to the oldest vector entries
- int opApply(scope int delegate(ref V value, ref bool kill) dg) ¶
-
Iterate from the most recent to the oldest vector entries