On Thursday, October 17, 2013 22:24:43 Vitali wrote: > On Thursday, 17 October 2013 at 20:01:37 UTC, David Nadlinger > > wrote: > > 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 > > This is maybe what I have missed. I will take a closer look on > it. Thank you. > > Thanks for every one who has posted here. I think the function > mentioned by David Nadlinger will solve my problems. > > That's all for today ^^.
Based on your responses, I suspect that you don't quite understand how slices work in D, and you're just going to shoot yourself in the foot by using assumeSafeAppend. If you haven't already read it, please read this article on arrays: http://dlang.org/d-array-article.html It should be enlightening. - Jonathan M Davis