BitSet::insert
pub fn insert(int i) -> bool Import
Source: use collections::bitset::{BitSet}; src/collections/bitset.hy Insert index i; returns true when newly set. i < 0 is ignored.
Called on a BitSet value as value.insert(…).
Parameters#
| Name | Type |
|---|---|
i | int |
Returns#
bool
Contracts#
Checked according to --contracts (see Contracts).
ensures i < 0 || self.contains(i)
ensures !result || self.count == old(self.count) + 1
ensures result || self.count == old(self.count)
See also#
BitSet: A set of non-negativeints stored as bits.BitSet::with_capacity: Empty set with storage for at leastbitsindices (0→ no words).BitSet::new: Empty set with no word storage (grows on insert).BitSet::size: Number of set bits (cardinality).BitSet::is_empty: Returnstruewhen no bit is set.BitSet::capacity: Current bit capacity (words.len() * 63); grows when inserting past it.BitSet::contains: True when indexiis set.BitSet::remove: Clear indexi; returnstruewhen a bit was unset.