bitset
Provides a compact set of non-negative integers backed by inline storage.
Optimized for space (1 bit per element) and speed (O(1) operations). Offers set/clear/test/toggle and fast population count.
Example:
from std.collections import BitSet
var bs = BitSet[128]() # 128-bit set, all clear
bs.set(42) # Mark value 42 as present.
if bs.test(42): # Check membership.
print("hit") # Prints "hit".
bs.clear(42) # Remove 42.
print(len(bs)) # Prints 0.
Structs
-
BitSet: A grow-only set storing non-negative integers efficiently using bits.