StringMap.length

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

Return Value

Type: size_t

number of elements in the table.

Examples

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

Meta