StringMap.clear

Removes all remaining keys and values from an associative array.

Complexity: O(1)

struct StringMap(T, U = uint)
@safe pure nothrow @nogc
void
clear
()
()
if (
isMutable!T &&
!__traits(hasMember, T, "opPostMove")
&&
__traits(isUnsigned, U)
)

Examples

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

Meta