The OpenD Programming Language

StringMap.remove

remove(key) does nothing if the given key does not exist and returns false. If the given key does exist, it removes it from the AA and returns true.

Complexity: O(log(s)) (not exist) or O(n) (exist), where s is the count of the strings with the same length as they key.

struct StringMap(T)
@trusted pure nothrow @nogc
bool
remove
()
(
scope const(char)[] key
)

Examples

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

Meta