aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2021-08-04 00:29:39 +0200
committerJakub Konka <kubkon@jakubkonka.com>2021-08-04 09:47:42 +0200
commitee6f7fee2900ea18bfd056e57952aba606158d7b (patch)
tree5360b0d6127090290171fe8711e675da31d4c99a /src
parentaad4598367b136a06e3569373be7da8febea7f31 (diff)
downloadzig-ee6f7fee2900ea18bfd056e57952aba606158d7b.tar.gz
zig-ee6f7fee2900ea18bfd056e57952aba606158d7b.zip
libstd: add ArrayHashMap.popOrNull function
which internally calls `ArrayHashMap.pop`, however, returns `?KV` instead and performs the bounds checking automatically. This function correponds to `ArrayList.popOrNull` and is meant to fill the gap for situations where we want the quick lookup offered by the hash map with elegant ability to iterate and pop of the container with automatic bound checking that plugs in well with a `while`-loop such as ```zig var map = std.ArrayHashMap(K, V).init(allocator); map.deinit(); while (map.popOrNull()) |entry| { // ... do something } assert(map.count() == 0); ```
Diffstat (limited to 'src')
0 files changed, 0 insertions, 0 deletions