diff options
author | Lynn C. Rees <lcrees@gmail.com> | 2017-09-08 11:09:58 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-08 11:09:58 -0600 |
commit | 5b2125dc3acb2b26fe20fa02e9ee424a42f68095 (patch) | |
tree | 6d2f87b954f1422036868df49414258f0af6b43b /lib/pure/strtabs.nim | |
parent | 811fbdafd958443ddac98ad58c77245860b38620 (diff) | |
download | Nim-5b2125dc3acb2b26fe20fa02e9ee424a42f68095.tar.gz |
Support `in` operator on StringTableRef
Diffstat (limited to 'lib/pure/strtabs.nim')
-rw-r--r-- | lib/pure/strtabs.nim | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/pure/strtabs.nim b/lib/pure/strtabs.nim index 858043128..75c5e171d 100644 --- a/lib/pure/strtabs.nim +++ b/lib/pure/strtabs.nim @@ -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): |