Do not add the top of the stack stack on the array list
This commit is contained in:
parent
dae0b3d39c
commit
15c75b9f69
1 changed files with 2 additions and 3 deletions
|
@ -6,6 +6,7 @@ pub const StackStack = struct {
|
||||||
data: std.ArrayList(*stack.Stack),
|
data: std.ArrayList(*stack.Stack),
|
||||||
toss: *stack.Stack,
|
toss: *stack.Stack,
|
||||||
pub fn deinit(self: *StackStack) void {
|
pub fn deinit(self: *StackStack) void {
|
||||||
|
self.toss.deinit();
|
||||||
for (self.data.items) |s| {
|
for (self.data.items) |s| {
|
||||||
s.deinit();
|
s.deinit();
|
||||||
}
|
}
|
||||||
|
@ -18,9 +19,7 @@ pub const StackStack = struct {
|
||||||
ss.allocator = allocator;
|
ss.allocator = allocator;
|
||||||
ss.data = std.ArrayList(*stack.Stack).init(allocator);
|
ss.data = std.ArrayList(*stack.Stack).init(allocator);
|
||||||
errdefer ss.data.deinit();
|
errdefer ss.data.deinit();
|
||||||
var s = try ss.data.addOne();
|
ss.toss = try stack.Stack.init(allocator);
|
||||||
s.* = try stack.Stack.init(allocator);
|
|
||||||
ss.toss = s.*;
|
|
||||||
return ss;
|
return ss;
|
||||||
}
|
}
|
||||||
pub inline fn toss(self: *StackStack) *stack.Stack {
|
pub inline fn toss(self: *StackStack) *stack.Stack {
|
||||||
|
|
Loading…
Add table
Reference in a new issue