std.algorithm.remove strange behavior (removing items for the dynamic array)

Jacob Carlborg doob at me.com
Thu May 10 23:48:20 PDT 2012


On 2012-05-11 08:24, Jonathan M Davis wrote:
> On Friday, May 11, 2012 08:15:45 Jacob Carlborg wrote:

>> Is it supposed to change the underlying array like that? It doesn't
>> print the original sequence.
>
> Yes. To remove an element, it shifts all of the elements to the right of that
> element over by one. It just doesn't change the elements on the end when it
> shifts elements over, so the last element gets duplicated.
>
> - Jonathan M Davis

Ok, I see.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list