Ownership of memory with hashmaps
Ziggit
Ownership of memory with hashmaps
I have this struct: const Foo = struct { bars: std.StringHashMap(Bar), }; The Bar struct has a deinit function that has an Allocator as a parameter. Most of the ways to interact with this struct is just updating bars in with the hashmap functions. Like the StringHashMap itself, should I make the user responsible for deallocating the memory Bar.deinit or, because the type is always the same, should I provide a Foo.deinit function that loops through each bar and runs Bar.deinit. Then who ...
0 comments
No comments yet.