Zig's recent updates to SinglyLinkedList and DoublyLinkedList have introduced significant changes, primarily transitioning to an intrusive linked list design for better performance and fewer allocations. This approach embeds the linked list node directly within the data, eliminating the need for separate allocations. The @fieldParentPtr builtin is utilized to navigate from the node to the containing data structure. Developers are encouraged to familiarize themselves with @fieldParentPtr despite its complexity, as it can be highly useful for otherwise challenging problems.

5m read timeFrom openmymind.net
Post cover image

Sort: