foreach support
key in map syntax support.
mapkey syntax support.
mapkey = value syntax support.
Remove key from the map.
Constructor with the Allocator.
Constructor taking an initial capacity and the Allocator. Given capacity is automatically normalized to proper value.
Constructor taking an initial capacity. Given capacity is automatically normalized to proper value.
Setter for hash seed.
Reorganizes the container in place.
Removes all remaining slots from a container.
key type
value type
Allocator type to use internal allocation. Default is "shared const Mallocator"
Assign V.init instead of RangeError when key not found. Default is "true"
initSlotInIndex is used for ++map[key] use-cases.
NOTE: Map doesn't guarantee pointer stability. Range and returned pointers are invalidated after insert/rehash.
// Initialize Map with capacity auto map = Map!(string, string)(10); // Default capacity is 0 map["key"] = "value"; auto p = "key" in map; if (p) *p = "new value"; writeln(map["key"]); // Print "new value" // Support AA properties map.length; map.clear; map.rehash; map.dup; K[] keys = map.keys; V[] values = map.values; foreach (k; map.byKey()) {} foreach (v; map.byValue()) {} foreach (e; map.byKeyValue()) {} // e has key and value properties
Copyright 2024- Masahiro Nakagawa Authros: Masahiro Nakagawa
Swiss tables hash map