mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 18:32:11 +00:00
Merge pull request #6351 from lcrees/patch-5
Support `in` operator on StringTableRef
This commit is contained in:
@@ -138,6 +138,10 @@ proc hasKey*(t: StringTableRef, key: string): bool {.rtlFunc, extern: "nst$1".}
|
||||
## returns true iff `key` is in the table `t`.
|
||||
result = rawGet(t, key) >= 0
|
||||
|
||||
proc contains*(t: StringTableRef, key: string): bool =
|
||||
## alias of `hasKey` for use with the `in` operator.
|
||||
return hasKey(t, key)
|
||||
|
||||
proc rawInsert(t: StringTableRef, data: var KeyValuePairSeq, key, val: string) =
|
||||
var h: Hash = myhash(t, key) and high(data)
|
||||
while not isNil(data[h].key):
|
||||
|
||||
Reference in New Issue
Block a user