This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH 2/3] dynarray: Implement remove function
On 07/02/2018 12:48, Alexander Monakov wrote:
> On Wed, 7 Feb 2018, Adhemerval Zanella wrote:
>> This patch implements the remove item function for dynarray array.
>> It is a costly operation, since it requires a memory move operation
>> possible as large as the array size less one element.
> If preserving order is not required, then removing an element is as
> cheap as moving only the last element to the position of the removed.
> If order preservation, is, in fact, part of the intended interface,
> then shouldn't the new function be named like '..._ordered_remove'
> to reflect that?
I see dynarray works similar to c++ vector container and the remove
usage on subsequent patch expects order preservation. So I would
prefer to use the other way around your suggestion: to add a
unordered_remove if the case.