mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-27 14:24:08 +00:00
Recommend swap_remove
in Vec::remove
docs
This commit is contained in:
parent
f3f8e758f2
commit
9a2e3f3a8e
@ -1360,6 +1360,12 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||
/// Removes and returns the element at position `index` within the vector,
|
||||
/// shifting all elements after it to the left.
|
||||
///
|
||||
/// Note: Because this shifts over the remaining elements, it has a
|
||||
/// worst-case performance of O(n). If you don't need the order of elements
|
||||
/// to be preserved, use [`swap_remove`] instead.
|
||||
///
|
||||
/// [`swap_remove`]: Vec::swap_remove
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `index` is out of bounds.
|
||||
|
Loading…
Reference in New Issue
Block a user