Hash maps now copy keys if keys are copyable.

This commit is contained in:
Christoffer Lerno
2023-08-10 21:14:24 +02:00
parent 356b6bb1b7
commit 3e765a3f3e
8 changed files with 80 additions and 18 deletions

View File

@@ -346,6 +346,12 @@ fn String String.copy(s, Allocator* using = mem::heap())
str[len] = 0;
return (String)str[:len];
}
fn void String.free(&s, Allocator* using = mem::heap())
{
if (!s.len) return;
mem::free(s.ptr, .using = using);
*s = "";
}
fn String String.tcopy(s) => s.copy(mem::temp()) @inline;