Arrays are sufficient for ArrayLists? Really??

Timon Gehr timon.gehr at gmx.ch
Mon May 16 12:56:03 PDT 2011


Timon Gehr wrote:
> 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 .. $];
> }

Sorry, still wrong:

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


More information about the Digitalmars-d mailing list