79822982

Date: 2025-11-18 04:34:30
Score: 0.5
Natty:
Report link

There are lots of different hash map types in Zig. Here's a blog post which breaks it all down: https://www.openmymind.net/Zigs-HashMap-Part-1/

In summary, you generally want to use AutoHashMap or StringHashMap. For example:

var h = std.AutoHashMap(MyKey, i32).init(allocator);
try h.put(MyKey{.foo = 0, .bar = 1}, 2);
defer h.deinit();

or

var h = std.StringHashMap(i32).init(allocator);
try h.put("three", 3);
defer h.deinit();
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: zacoons