Merge pull request #4367 from kierdavis/4365-tables-clear

Improvements to tables.clear()
This commit is contained in:
Andreas Rumpf 2016-08-25 16:46:53 +02:00 • committed by GitHub
commit 1e134aed49
4 changed files with 53 additions and 4 deletions

View file

@ -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