Module intsets

The intsets module implements an efficient int set implemented as a sparse bit set. Note: Since Nim currently does not allow the assignment operator to be overloaded, = for int sets performs some rather meaningless shallow copy; use assign to get a deep copy.

Types

BitScalar = int
  Source
IntSet = object
  counter, max: int
  head: PTrunk
  data: TrunkSeq
an efficient set of 'int' implemented as a sparse bit set   Source

Procs

proc contains(s: IntSet; key: int): bool {.raises: [], tags: [].}
returns true iff key is in s.   Source
proc incl(s: var IntSet; key: int) {.raises: [], tags: [].}
includes an element key in s.   Source
proc excl(s: var IntSet; key: int) {.raises: [], tags: [].}
excludes key from the set s.   Source
proc containsOrIncl(s: var IntSet; key: int): bool {.raises: [], tags: [].}
returns true if s contains key, otherwise key is included in s and false is returned.   Source
proc initIntSet(): IntSet {.raises: [], tags: [].}
creates a new int set that is empty.   Source
proc isNil(x: IntSet): bool {.inline, raises: [], tags: [].}
  Source
proc assign(dest: var IntSet; src: IntSet) {.raises: [], tags: [].}
copies src to dest. dest does not need to be initialized by initIntSet.   Source
proc `$`(s: IntSet): string {.raises: [], tags: [].}
The $ operator for int sets.   Source
proc empty(s: IntSet): bool {.inline, deprecated, raises: [], tags: [].}
returns true if s is empty. This is safe to call even before the set has been initialized with initIntSet. Note this never worked reliably and so is deprecated.   Source

Iterators

iterator items(s: IntSet): int {.inline, raises: [], tags: [].}
iterates over any included element of s.   Source