StringMap.capacity

(Property) Gets the current capacity of an associative array. The capacity is the size that the underlaynig slices can grow to before the underlying arrays may be reallocated or extended.

Complexity: O(1)

struct StringMap(T, U = uint)
@safe pure nothrow const @property
size_t
capacity
()
()
if (
isMutable!T &&
!__traits(hasMember, T, "opPostMove")
&&
__traits(isUnsigned, U)
)

Examples

StringMap!double map;
assert(map.capacity == 0);
map["c"] = 4.0;
assert(map.capacity >= 1);
map["a"] = 3.0;
assert(map.capacity >= 2);
map.remove("c");
map.assumeSafeAppend;
assert(map.capacity >= 2);

Meta