try to push this time
parent
72ff38beb9
commit
0c0d74c00e
15
LList.zig
15
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;
|
||||
|
|
Loading…
Reference in New Issue