Closed
Description
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.