The
intsets module implements an efficient int set implemented as a sparse bit set.
Note: Since Nimrod 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.
TBitScalar = int
-
TIntSet = object
counter, max: int
head: PTrunk
data: TTrunkSeq
-
an efficient set of 'int' implemented as a sparse bit set
proc contains(s: TIntSet; key: int): bool {.raises: [], tags: [].}
-
returns true iff key is in s.
proc incl(s: var TIntSet; key: int) {.raises: [], tags: [].}
-
includes an element key in s.
proc excl(s: var TIntSet; key: int) {.raises: [], tags: [].}
-
excludes key from the set s.
proc containsOrIncl(s: var TIntSet; key: int): bool {.raises: [], tags: [].}
-
returns true if s contains key, otherwise key is included in s and false is returned.
proc initIntSet(): TIntSet {.raises: [], tags: [].}
-
creates a new int set that is empty.
proc assign(dest: var TIntSet; src: TIntSet) {.raises: [], tags: [].}
-
copies src to dest. dest does not need to be initialized by initIntSet.
proc `$`(s: TIntSet): string {.raises: [], tags: [].}
-
The $ operator for int sets.
proc empty(s: TIntSet): bool {.inline, raises: [], tags: [].}
-
returns true if s is empty. This is safe to call even before the set has been initialized with initIntSet.
iterator items(s: TIntSet): int {.inline, raises: [], tags: [].}
-
iterates over any included element of s.