Hash_Table module

table_find_pointer

procedureSource

A pointer to the value stored for key, or null when there is none, so the value can be changed in place.

The pointer is valid until the table grows or the entry is removed. Looking up in a table that never held anything is fine and finds nothing.

Example↗
counts: Table(string, int);
table_add(*counts, "a", 1);
pointer := table_find_pointer(*counts, "a");
pointer.* += 1;
assert(table_find_pointer(*counts, "a").* == 2);
assert(table_find_pointer(*counts, "b") == null);
deinit(*counts);
table_find_pointer :: (table: *Table, key: table.Key_Type) -> *table.Value_Type

Parameters

table: *Table
key: table.Key_Type

Returns

*table.Value_Type

See also