On Tue, 10 Apr 2012 12:01:10 +0200, CrudOMatic <crudoma...@gmail.com>
wrote:
Awesome. One last question, does popFront() have the same effect of
decreasing length - or should I avoid popFront()?
popFront will also reduce the length, but it will slice away the first
item. Read the article I linked earlier.
This means that if you append to the array, the array will keep expanding
and eventually relocate as you cannot reuse the front of the array without
doing some manual work.
It sounds to me like you want popBack and assumeSafeAppend.
This is basically what popBack and popFront from std.array looks like:
void popBack(A)(ref A a)
{
a = a[0 .. $ - 1]; // $ is a.length
}
void popFront(A)(ref A a)
{
a = a[1 .. $];
}