Merge pull request #3421 from jlp765/strtab1
fix #3416 strtabs clear() and []=
This commit is contained in:
commit
8f9438d29a
1 changed files with 6 additions and 0 deletions
|
|
@ -173,6 +173,9 @@ proc clear*(s: StringTableRef, mode: StringTableMode) =
|
|||
s.mode = mode
|
||||
s.counter = 0
|
||||
s.data.setLen(startSize)
|
||||
for i in 0..<s.data.len:
|
||||
if not isNil(s.data[i].key):
|
||||
s.data[i].key = nil
|
||||
|
||||
proc newStringTable*(keyValuePairs: varargs[string],
|
||||
mode: StringTableMode): StringTableRef {.
|
||||
|
|
@ -248,3 +251,6 @@ when isMainModule:
|
|||
x.mget("11") = "23"
|
||||
assert x["11"] == "23"
|
||||
|
||||
x.clear(modeCaseInsensitive)
|
||||
x["11"] = "22"
|
||||
assert x["11"] == "22"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue