Merge pull request #4367 from kierdavis/4365-tables-clear
Improvements to tables.clear()
This commit is contained in:
commit
1e134aed49
4 changed files with 53 additions and 4 deletions
|
|
@ -142,7 +142,8 @@ template delImpl() {.dirty.} =
|
|||
|
||||
template clearImpl() {.dirty.} =
|
||||
for i in 0 .. <t.data.len:
|
||||
t.data[i].hcode = 0
|
||||
when compiles(t.data[i].hcode): # CountTable records don't contain a hcode
|
||||
t.data[i].hcode = 0
|
||||
t.data[i].key = default(type(t.data[i].key))
|
||||
t.data[i].val = default(type(t.data[i].val))
|
||||
t.counter = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue