const Iterator = struct {
partition: *Self,
// Window
win_x: usize, // inclusive
win_max_x: usize, // exclusive
win_max_y: usize, // exclusive
// State
x: usize,
y: usize,
buffer: [32]*T = undefined,
list: std.ArrayList(*T),
pub fn init(self: *Self, win: ArrayWindow) Iterator {
var result = Iterator{
.partition = self,
.win_x = win.x,
.win_max_x = win.x + win.w,
.win_max_y = win.y + win.h,
.x = win.x,
.y = win.y,
};
result.list = .initBuffer(&result.buffer);
return result;
}
}
I'm not sure what happens here with stack pointers, if this is invalid how could I change it so the list is properly initialized?