added critbits.inc proc

This commit is contained in:
Araq 2015-10-06 10:58:00 +02:00
commit 732bdd54a0

View file

@ -123,6 +123,14 @@ proc containsOrIncl*(c: var CritBitTree[void], key: string): bool =
var n = rawInsert(c, key) var n = rawInsert(c, key)
result = c.count == oldCount result = c.count == oldCount
proc inc*(c: var CritBitTree[int]; key: string) =
## counts the 'key'.
let oldCount = c.count
var n = rawInsert(c, key)
if c.count == oldCount:
# not a new key:
inc n.val
proc incl*(c: var CritBitTree[void], key: string) = proc incl*(c: var CritBitTree[void], key: string) =
## includes `key` in `c`. ## includes `key` in `c`.
discard rawInsert(c, key) discard rawInsert(c, key)