added critbits.inc proc
This commit is contained in:
parent
8e9c0db66d
commit
732bdd54a0
1 changed files with 8 additions and 0 deletions
|
|
@ -123,6 +123,14 @@ proc containsOrIncl*(c: var CritBitTree[void], key: string): bool =
|
|||
var n = rawInsert(c, key)
|
||||
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) =
|
||||
## includes `key` in `c`.
|
||||
discard rawInsert(c, key)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue