diff options
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/collections/hashtables.nim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/pure/collections/hashtables.nim b/lib/pure/collections/hashtables.nim index 29ba6bf6f..4f4c4f5a0 100644 --- a/lib/pure/collections/hashtables.nim +++ b/lib/pure/collections/hashtables.nim @@ -216,9 +216,16 @@ proc `[]=`*[A, B](t: TOrderedHashTable[A, B], key: A, val: B) = inc(t.counter) proc del*[A, B](t: TOrderedHashTable[A, B], key: A) = - ## deletes `key` from hash table `t`. + ## deletes `key` from hash table `t`. Warning: It's inefficient for ordered + ## tables: O(n). var index = RawGet(t, key) if index >= 0: + var i = t.first + while i >= 0: + var nxt = t.data[i].next + if nxt == index: XXX + i = nxt + t.data[index].slot = seDeleted dec(t.counter) |