copy out keys also in HashMap.copy_keys (#1569)

* copy out keys also in HashMap.copy_keys
* test for copying keys out
This commit is contained in:
Walther Chen
2024-10-25 19:57:00 -04:00
committed by GitHub
parent 8ce63106b9
commit fd1898b70a
3 changed files with 26 additions and 2 deletions

View File

@@ -313,7 +313,11 @@ fn Key[] HashMap.copy_keys(&map, Allocator allocator = allocator::heap())
{
while (entry)
{
list[index++] = entry.key;
$if COPY_KEYS:
list[index++] = entry.key.copy(allocator);
$else
list[index++] = entry.key;
$endif
entry = entry.next;
}
}