> In fact I even need to take that back. In order to work correctly, the
> function would have to iterate downwards. It _is_ indeed buggy, and I
> should stop emitting opinions when I'm short on time...
>
> Andrei

Whoops, you are right:

void removeAt(T)(ref T[] arr, size_t index)
{
   foreach (i, ref item; retro(arr[1 .. index+1]))
        item = arr[i - 1];
    arr = arr[1 .. $];
}

Timon

Reply via email to