Skip to content

Add vec::swap_remove #3219

Closed
Closed
@eholk

Description

@eholk

It'd be nice to have a function that removes an element from the middle of a vector and replaces it with the element at the end. It's important that it not require a copy bound.

One place this would be useful is in pipes::select, which must remove the selected endpoint from the list. Currently we have a linear time operation to rebuild the vector, while swap_remove would make it a constant time operation. This could be important for performance in, for example, servo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions