From 0c0d74c00e410a29c1cc3aeeae243b17539548df Mon Sep 17 00:00:00 2001 From: 3011357 <3011357@stud.hs-mannheim.de> Date: Fri, 8 Nov 2024 20:26:58 +0100 Subject: [PATCH] try to push this time --- LList.zig | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/LList.zig b/LList.zig index 95fa817..2b57517 100644 --- a/LList.zig +++ b/LList.zig @@ -1,17 +1,12 @@ const std = @import("std"); -pub fn LLIst (comptime T: type) type { +pub fn LList (comptime T: type) type { return struct { const Self = @This(); - first: *Node(T), - //TODO Liste mit allen Nodes erstellen + first: ?*Node(T), - pub fn init(this: *Self) !void { - //TODO Heap mit allocater nutzen - var node: Node(T) = undefined; - node.init(69); - try node.printNode(); - this.first = &node; + pub fn init(this: *Self) !void { // ! allocator: *std.mem.allocator als zweiter Parameter + this.first = null; } pub fn deinit() void { @@ -25,8 +20,6 @@ pub fn Node (comptime T: type) type { const Self = @This(); next: *Self, //? Nächste Node in der Liste - position: i64, //? Position der Node in der List, später übergeben mit zB List.len - value: T, pub fn init(this: *Self, value: T) void { this.value = value;