StringMap.reserve

Reserves capacity for an associative array. The capacity is the size that the underlaying slices can grow to before the underlying arrays may be reallocated or extended.

struct StringMap(T)
@trusted pure nothrow
size_t
reserve
()
()

Examples

StringMap!double map;
auto capacity = map.reserve(10);
assert(capacity >= 10);
assert(map.capacity == capacity);
map["c"] = 4.0;
assert(map.capacity == capacity);
map["a"] = 3.0;
assert(map.capacity >= 2);
assert(map.remove("c"));
capacity = map.reserve(20);
assert(capacity >= 20);
assert(map.capacity == capacity);