Skip to content

Commit

Permalink
IndexSet::swap_indices is O(1) too
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Feb 11, 2024
1 parent 4572493 commit 5debe73
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,8 @@ impl<T, S> IndexSet<T, S> {
/// Swaps the position of two values in the set.
///
/// ***Panics*** if `a` or `b` are out of bounds.
///
/// Computes in **O(1)** time (average).
pub fn swap_indices(&mut self, a: usize, b: usize) {
self.map.swap_indices(a, b)
}
Expand Down

0 comments on commit 5debe73

Please sign in to comment.