[PATCH 2/3] dynarray: Implement remove function

Alexander Monakov amonakov@ispras.ru
Wed Feb 7 15:07:00 GMT 2018


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?

Alexander



More information about the Libc-alpha mailing list