RSSAmplifier

openmymind.net · Apr 10, 2025

Zig's new LinkedList API (it's time to learn @fieldParentPtr)

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

In a recent, post-Zig 0.14 commit, Zig's SinglyLinkedList and DoublyLinkedList saw significant changes . The previous version was a generic and, with all the methods removed, looked like: pub fn SinglyLinkedList(comptime T: type) type { return struct { first: ?*Node = null, pub const Node = struct { next: ?*Node = null, data: T, }; }; } The new version isn't generic. Rather, you embed the linked…

Read on openmymind.net

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.