diff options
Diffstat (limited to 'lib/pure/collections')
-rwxr-xr-x | lib/pure/collections/intsets.nim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/pure/collections/intsets.nim b/lib/pure/collections/intsets.nim index fcaf7b212..2a8d7eec2 100755 --- a/lib/pure/collections/intsets.nim +++ b/lib/pure/collections/intsets.nim @@ -190,6 +190,11 @@ proc `$`*(s: TIntSet): string = ## The `$` operator for int sets. dollarImpl() +proc empty*(s: TIntSet): bool {.inline.} = + ## returns true if `s` is empty. This is safe to call even before + ## the set has been initialized with `initIntSet`. + result = s.counter == 0 + when isMainModule: var x = initIntSet() x.incl(1) |