Set.capacity

Maximum amount of elements this $(D_PSYMBOL Set) 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 Set(T, alias hasher = hash)
@property const
size_t
capacity
()
if (
isHashFunction!(hasher, T)
)

Return Value

Type: size_t

$(D_PSYMBOL Set) capacity.

Examples

Set!int set;
assert(set.capacity == 0);

set.insert(8);
assert(set.capacity == 3);

Meta