> > First one allocates new memory block. > Second one attempts to erase an element in-place. Dupping, however, > allocates new memory, too. > The best solution would be as follows: > > void eraseNth(ref T[] data, int n) { > data[n] = data[$-1]; > data.length = data.length - 1; > } Yay, thats how I do it :)