mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Hash maps now copy keys if keys are copyable.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user