On Thursday, 17 October 2013 at 18:41:53 UTC, Vitali wrote:
void removeElement(ref int[] arr, int index) {
  arr = arr[0..index] ~ arr[index+1..$];
}

If you know that 'arr' is the only reference to this piece of data, you can use arr.assumeSafeAppend() to enable re-use of the remaining storage: http://dlang.org/phobos/object.html#.assumeSafeAppend

David

Reply via email to