zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 05fc4d34a93d1e8fd4a107cb17c9d4fd7ffc29bc (tree)
parent edebe0586bd0cb73ef8492fd569e1c2fc7aca05b
Author: Josh Wolfe <thejoshwolfe@gmail.com>
Date:   Sat,  7 Dec 2019 13:22:23 -0500

documentation for mutable HashMap KV pointers

Diffstat:
Mlib/std/hash_map.zig | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/lib/std/hash_map.zig b/lib/std/hash_map.zig @@ -42,6 +42,11 @@ pub fn HashMap(comptime K: type, comptime V: type, comptime hash: fn (key: K) u3 const Self = @This(); + /// A *KV is a mutable pointer into this HashMap's internal storage. + /// Modifying the key is undefined behavior. + /// Modifying the value is harmless. + /// *KV pointers become invalid whenever this HashMap is modified, + /// and then any access to the *KV is undefined behavior. pub const KV = struct { key: K, value: V,