diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-08-07 20:08:37 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-08-07 20:08:37 -0700 |
| commit | 0d5ecc4312f45f9288c4a349837f04b733405960 (patch) | |
| tree | e5b61cab7f98f36025b4bbb85d9bef7239162aa5 /std | |
| parent | 275410dc33d3f040be9213d5f8175e1ced6c6a7d (diff) | |
| download | zig-0d5ecc4312f45f9288c4a349837f04b733405960.tar.gz zig-0d5ecc4312f45f9288c4a349837f04b733405960.zip | |
ability to have a return type of 'type'
Diffstat (limited to 'std')
| -rw-r--r-- | std/hash_map.zig | 6 | ||||
| -rw-r--r-- | std/list.zig | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/std/hash_map.zig b/std/hash_map.zig index a42a7839cd..7778d0f268 100644 --- a/std/hash_map.zig +++ b/std/hash_map.zig @@ -6,8 +6,8 @@ const Allocator = mem.Allocator; const want_modification_safety = !@compile_var("is_release"); const debug_u32 = if (want_modification_safety) u32 else void; -pub inline fn HashMap(inline K: type, inline V: type, - inline hash: fn(key: K)->u32, inline eql: fn(a: K, b: K)->bool) +pub fn HashMap(inline K: type, inline V: type, inline hash: fn(key: K)->u32, + inline eql: fn(a: K, b: K)->bool) -> type { SmallHashMap(K, V, hash, eql, 8) } @@ -258,7 +258,7 @@ fn global_free(self: &Allocator, old_mem: []u8) { #attribute("test") fn basic_hash_map_test() { - var map: SmallHashMap(i32, i32, hash_i32, eql_i32, 4) = undefined; + var map: HashMap(i32, i32, hash_i32, eql_i32) = undefined; map.init(&global_allocator); defer map.deinit(); diff --git a/std/list.zig b/std/list.zig index d7b0bdb8cb..fd2aba2b27 100644 --- a/std/list.zig +++ b/std/list.zig @@ -2,7 +2,7 @@ const assert = @import("debug.zig").assert; const mem = @import("mem.zig"); const Allocator = mem.Allocator; -pub inline fn List(inline T: type) -> type { +pub fn List(inline T: type) -> type { SmallList(T, 8) } @@ -77,7 +77,7 @@ fn global_free(self: &Allocator, old_mem: []u8) { #attribute("test") fn basic_list_test() { - var list: SmallList(i32, 4) = undefined; + var list: List(i32) = undefined; list.init(&global_allocator); defer list.deinit(); |
