Hash_Table module

table_find_multiple

procedure · 1 overloadSource

Every value stored under key, as a view into temporary storage (talloc), or an empty view when there are none.

Meant for tables that hold duplicate keys through table_add. The values come in slot order, which is not necessarily the order they were added in. The view is only valid until the temporary storage is reset, so copy it if it must live longer. It does not need freeing.

ExampleOpen in playground ↗
table: Table(int, string);
table_add(*table, 1, "a");
table_add(*table, 1, "b");
table_add(*table, 2, "c");
assert(table_find_multiple(*table, 1).count == 2);
assert(table_find_multiple(*table, 9).count == 0);
deinit(*table);
table_find_multiple :: (
    table: *Table,
    key: table.Key_Type
) -> [] table.Value_Type

Every value stored under key, as a view into temporary storage (talloc), or an empty view when there are none.

Meant for tables that hold duplicate keys through table_add. The values come in slot order, which is not necessarily the order they were added in. The view is only valid until the temporary storage is reset, so copy it if it must live longer. It does not need freeing.

Parameters

table: *Table
key: table.Key_Type

Returns

[] table.Value_Type
ExampleOpen in playground ↗
table: Table(int, string);
table_add(*table, 1, "a");
table_add(*table, 1, "b");
table_add(*table, 2, "c");
assert(table_find_multiple(*table, 1).count == 2);
assert(table_find_multiple(*table, 9).count == 0);
deinit(*table);

See also