StringMap.keys

Returns a dynamic array, the elements of which are the keys in the associative array. Doesn't allocate a new copy.

Complexity: O(1)

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

Examples

StringMap!double map;
assert(map.keys == []);
map["c"] = 4.0;
assert(map.keys == ["c"]);
map["a"] = 3.0;
assert(map.keys == ["c", "a"]);
map.remove("c");
assert(map.keys == ["a"]);
map.remove("a");
assert(map.keys == []);
map["c"] = 4.0;
assert(map.keys == ["c"]);

Meta