aboutsummaryrefslogtreecommitdiff
path: root/std/hash_map.zig
diff options
context:
space:
mode:
Diffstat (limited to 'std/hash_map.zig')
-rw-r--r--std/hash_map.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/std/hash_map.zig b/std/hash_map.zig
index 0c100e15d9..9654d612a5 100644
--- a/std/hash_map.zig
+++ b/std/hash_map.zig
@@ -408,6 +408,22 @@ test "iterator hash map" {
assert(entry.value == values[0]);
}
+pub fn getHashPtrAddrFn(comptime K: type) (fn (K) u32) {
+ return struct {
+ fn hash(key: K) u32 {
+ return getAutoHashFn(usize)(@ptrToInt(key));
+ }
+ }.hash;
+}
+
+pub fn getTrivialEqlFn(comptime K: type) (fn (K, K) bool) {
+ return struct {
+ fn eql(a: K, b: K) bool {
+ return a == b;
+ }
+ }.eql;
+}
+
pub fn getAutoHashFn(comptime K: type) (fn (K) u32) {
return struct {
fn hash(key: K) u32 {