We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In previous versions of Zig (pre 4.0) they used to be copies, but now they're an alias it seems.
My linked list code which previously worked fine is now broken.
https://github.com/BarabasGitHub/ZigZag/blob/f76697ddcfb10d25e35bc4594db4e605ce871be8/containers/single_linked_list.zig#L20
pub fn next(self: *Iterator) ?*Value { if (self.node) |node| { self.node = node.next; return &node.value; } else { return null; } }
https://github.com/BarabasGitHub/ZigZag/blob/f76697ddcfb10d25e35bc4594db4e605ce871be8/containers/single_linked_list.zig#L47
pub fn count(self: Self) usize { var i = usize(0); var node = self.head; while (node) |n| { node = n.next; i += 1; } return i; }
https://github.com/BarabasGitHub/ZigZag/blob/f76697ddcfb10d25e35bc4594db4e605ce871be8/containers/single_linked_list.zig#L88
pub fn clear(self: *Self) void { var node = self.head; while (node) |n| { node = n.next; self.allocator.destroy(n); } self.head = null; }
Maybe this is how it's supposed to work, but it's not very intuitive.
The fix was to make explicit copies, one way or another, see: BarabasGitHub/ZigZag@42148fd#diff-fe4c994cb2028068ff82d5e173fd2bf9
The text was updated successfully, but these errors were encountered:
duplicate of #2915
Sorry, something went wrong.
No branches or pull requests
In previous versions of Zig (pre 4.0) they used to be copies, but now they're an alias it seems.
My linked list code which previously worked fine is now broken.
https://github.com/BarabasGitHub/ZigZag/blob/f76697ddcfb10d25e35bc4594db4e605ce871be8/containers/single_linked_list.zig#L20
https://github.com/BarabasGitHub/ZigZag/blob/f76697ddcfb10d25e35bc4594db4e605ce871be8/containers/single_linked_list.zig#L47
https://github.com/BarabasGitHub/ZigZag/blob/f76697ddcfb10d25e35bc4594db4e605ce871be8/containers/single_linked_list.zig#L88
Maybe this is how it's supposed to work, but it's not very intuitive.
The fix was to make explicit copies, one way or another, see: BarabasGitHub/ZigZag@42148fd#diff-fe4c994cb2028068ff82d5e173fd2bf9
The text was updated successfully, but these errors were encountered: