inferred leading comptime params

This commit is contained in:
2026-07-12 17:02:12 +02:00
parent 0706188b98
commit 2dea7711f2
11 changed files with 769 additions and 84 deletions
+3 -3
View File
@@ -18,7 +18,7 @@ init func($T type, allocator mem.Allocator) ArrayList(T) {
deinit func($T type, list @mut ArrayList(T)) void {
allocation []mut T :: list.items.ptr[..list.capacity]
mem.free(T, list.allocator, allocation)
mem.free(list.allocator, allocation)
list.items = mem.empty(T)
list.capacity = 0
}
@@ -43,7 +43,7 @@ reserve func($T type, list @mut ArrayList(T), minimum_capacity usize) void ! mem
length usize :: list.items.len
allocation []mut T :: list.items.ptr[..list.capacity]
grown []mut T :: mem.realloc(T, list.allocator, allocation, new_capacity) catch |_| {
grown []mut T :: mem.realloc(list.allocator, allocation, new_capacity) catch |_| {
return .out_of_memory
}
list.items = grown.ptr[..length]
@@ -56,7 +56,7 @@ append func($T type, list @mut ArrayList(T), value T) void ! mem.AllocError {
if length == max_value(usize) {
return .out_of_memory
}
try reserve(T, list, length + 1)
try reserve(list, length + 1)
list.items = list.items.ptr[..length + 1]
list.items[length] = value
return _