Arrays are sufficient for ArrayLists? Really??

Timon Gehr timon.gehr at gmx.ch
Mon May 16 13:03:15 PDT 2011


foreach is a very bad choice for solving this. I blindly took it over from the
original code. Need to get some sleep :).

This now definitely works, and is also the shortest:

void removeAt(T)(ref T[] arr, size_t index){
    for(auto i = index; i; i--) arr[i] = arr[i - 1];
    arr = arr[1 .. $];
}

Timon


More information about the Digitalmars-d mailing list