pub fn putAll(m: *Map, other: *const Map) Allocator.Error!void 354
355
356
357
358
359
360
361
362
363
364
365
366 pub fn putAll(m: *Map, other: *const Map) Allocator.Error!void {
const gpa = m.allocator;
try m.array_hash_map.ensureUnusedCapacity(gpa, other.array_hash_map.count());
const start = m.count();
errdefer while (m.array_hash_map.count() > start) {
const kv = m.array_hash_map.pop().?;
gpa.free(kv.key);
gpa.free(kv.value);
};
for (other.array_hash_map.keys(), other.array_hash_map.values()) |key, value| {
try m.put(key, value);
}
}
Adds all the key-value pairs from
otherinto thism.