Initialize the associtave array with default value.
Constructs an associative array using keys and values from the builtin associative array Complexity: O(n log(n))
Constructs an associative array using keys and values.
Assume that it is safe to append to this associative array. Appends made to this associative array after calling this function may append in place, even if the array was a slice of a larger array to begin with. Use this only when it is certain there are no elements in use beyond the associative array in the memory block. If there are, those elements will be overwritten by appending to this associative array.
(Property) Gets the current capacity of an associative array. The capacity is the size that the underlaynig slices can grow to before the underlying arrays may be reallocated or extended.
Removes all remaining keys and values from an associative array.
Finds position of the key in the associative array .
Looks up key; if it exists returns corresponding value else evaluates and returns defaultValue.
Returns a dynamic array, the elements of which are the keys in the associative array. Doesn't allocate a new copy.
Reset the associtave array
Complexity: O(log(s)), where s is the number of the keys with the same length as the input key.
Complexity: O(log(s)), where s is the number of the keys with the same length as the input key.
Complexity: O(log(s)) (exist) or O(n) (not exist), where s is the count of the strings with the same length as they key.
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.
Looks up key; if it exists returns corresponding value else evaluates value, adds it to the associative array and returns it.
Reserves capacity for an associative array. The capacity is the size that the underlaying slices can grow to before the underlying arrays may be reallocated or extended.
Returns a dynamic array, the elements of which are the values in the associative array. Doesn't allocate a new copy.
Converts the associtave array to a common Dlang associative array.
mutable value type, can be instance of $(AlgebraicREF Algebraic) for example.
an unsigned type that can hold an index of keys. U.max must be less then the maximum possible number of struct members.
StringMap!int table; table["L"] = 3; table["A"] = 2; table["val"] = 1; assert(table.keys == ["L", "A", "val"]); assert(table.values == [3, 2, 1]); assert(table["A"] == 2); table.values[2] += 10; assert(table["A"] == 2); assert(table["L"] == 3); assert(table["val"] == 11); assert(table.keys == ["L", "A", "val"]); assert(table.values == [3, 2, 11]); table.remove("A"); assert(table.keys == ["L", "val"]); assert(table.values == [3, 11]); assert(table["L"] == 3); assert(table["val"] == 11); assert(table == table);
Ordered string-value associtaive array with extremely fast lookup.