#How to pass AutoHashMap into functions
1 messages · Page 1 of 1 (latest)
var hash_map: std.AutoHashMap(K, V) = .init(allocator);
fn func(hash_map: *WhatTypeIsSupposedToBeHere) i8 {...}
Save the type so it can be reused.
const SpecificHashMap = std.AutoHashMap(K, V);
var hash_map: SpecificHashMap = .init(allocator);
fn func(hash_map: *SpecificHashMap) i8 {...}```
Retyping std.AutoHashMap(K, V) in the function signature is also fine, it might read better than saving the type to a new name.
var hash_map: std.AutoHashMap(K, V) = .init(allocator);
fn func(hash_map: *std.AutoHashMap(K, V)) i8 {...}```