On Thursday, 30 April 2015 at 22:01:43 UTC, Justin Whear wrote:
On Thu, 30 Apr 2015 21:30:34 +0000, TheGag96 wrote:
Was the behavior of the remove() function changed recently?
Thanks guys.
I believe remove has always worked this way. What you're
seeing is
explained by this note in the documentation for remove:
The original array has remained of the same length because all
functions in std.algorithm only change content, not topology.
The value 8 is repeated because std.algorithm.move was invoked
to move elements around and on integers move simply copies the
source to the destination. To replace a with the effect of the
removal, simply assign a = remove(a, 1). The slice will be
rebound to the shorter array and the operation completes with
maximal efficiency.
Ah... This is all a lot clearer now. Thanks guys!