On Thursday, 17 October 2013 at 18:41:53 UTC, Vitali wrote:
  arr = arr[0..index] ~ arr[index+1..$];

This line is where the reallocation happens. a ~ b on built in arrays and slices, ALWAYS allocates to ensure it doesn't stomp over some other in-use memory.

~= can extend if there's capacity, but ~ always makes a new array without modifying the input. Ali linked to the array article that explains the implementation in more detail.


The remove function should copy the data itself instead of using the ~ operator if you want it to operate in place.

Reply via email to