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.
IntSet = object elems: int counter, max: int head: PTrunk data: TrunkSeq a: array[0 .. 33, int]
proc contains(s: IntSet; key: int): bool {...}{.raises: [], tags: [].}
proc incl(s: var IntSet; key: int) {...}{.raises: [], tags: [].}
proc incl(s: var IntSet; other: IntSet) {...}{.raises: [], tags: [].}
proc excl(s: var IntSet; key: int) {...}{.raises: [], tags: [].}
proc excl(s: var IntSet; other: IntSet) {...}{.raises: [], tags: [].}
proc missingOrExcl(s: var IntSet; key: int): bool {...}{.raises: [], tags: [].}
proc containsOrIncl(s: var IntSet; key: int): bool {...}{.raises: [], tags: [].}
proc initIntSet(): IntSet {...}{.raises: [], tags: [].}
proc clear(result: var IntSet) {...}{.raises: [], tags: [].}
proc isNil(x: IntSet): bool {...}{.inline, raises: [], tags: [].}
proc assign(dest: var IntSet; src: IntSet) {...}{.raises: [], tags: [].}
proc union(s1, s2: IntSet): IntSet {...}{.raises: [], tags: [].}
proc intersection(s1, s2: IntSet): IntSet {...}{.raises: [], tags: [].}
proc difference(s1, s2: IntSet): IntSet {...}{.raises: [], tags: [].}
proc symmetricDifference(s1, s2: IntSet): IntSet {...}{.raises: [], tags: [].}
proc `+`(s1, s2: IntSet): IntSet {...}{.inline, raises: [], tags: [].}
proc `*`(s1, s2: IntSet): IntSet {...}{.inline, raises: [], tags: [].}
proc `-`(s1, s2: IntSet): IntSet {...}{.inline, raises: [], tags: [].}
proc disjoint(s1, s2: IntSet): bool {...}{.raises: [], tags: [].}
proc len(s: IntSet): int {...}{.inline, raises: [], tags: [].}
proc card(s: IntSet): int {...}{.inline, raises: [], tags: [].}
proc `<=`(s1, s2: IntSet): bool {...}{.raises: [], tags: [].}
proc `<`(s1, s2: IntSet): bool {...}{.raises: [], tags: [].}
proc `==`(s1, s2: IntSet): bool {...}{.raises: [], tags: [].}
proc `$`(s: IntSet): string {...}{.raises: [], tags: [].}
proc empty(s: IntSet): bool {...}{.inline, deprecated, raises: [], tags: [].}
iterator items(s: IntSet): int {...}{.inline, raises: [], tags: [].}
© 2006–2018 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/intsets.html