Module intsets

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.

Types

TIntSet* {.final.} = object 
  counter, max: int
  head: PTrunk
  data: TTrunkSeq
an efficient set of 'int' implemented as a sparse bit set

Procs

proc contains*(s: TIntSet; key: int): bool
returns true iff key is in s.
proc incl*(s: var TIntSet; key: int)
includes an element key in s.
proc excl*(s: var TIntSet; key: int)
excludes key from the set s.
proc containsOrIncl*(s: var TIntSet; key: int): bool
returns true if s contains key, otherwise key is included in s and false is returned.
proc initIntSet*(): TIntSet
creates a new int set that is empty.
proc assign*(dest: var TIntSet; src: TIntSet)
copies src to dest. dest does not need to be initialized by initIntSet.
proc `$`*(s: TIntSet): string
The $ operator for int sets.

Iterators

iterator items*(s: TIntSet): int {.inline.}
iterates over any included element of s.
Generated: 2012-09-23 21:47:54 UTC