HashTable.capacity

Maximum amount of elements this $(D_PSYMBOL HashTable) can hold without resizing and rehashing. Note that it doesn't mean that the $(D_PSYMBOL Set) will hold exactly $(D_PSYMBOL capacity) elements. $(D_PSYMBOL capacity) tells the size of the container under a best-case distribution of elements.

struct HashTable(Key, Value, alias hasher = hash)
@property const
size_t
capacity
()
if (
isHashFunction!(hasher, Key)
)

Return Value

Type: size_t

$(D_PSYMBOL HashTable) capacity.

Examples

HashTable!(string, int) hashTable;
assert(hashTable.capacity == 0);

hashTable["eight"] = 8;
assert(hashTable.capacity == 3);

Meta