MapFindFirstForKey
Description
Find the first value stored for a key as a cursor.
Parameters
| Name | Direction | Description |
|---|---|---|
m |
in | Map. |
lookup_key |
in | Key to search for. |
Success
Returns a MapValueCursor positioned at the first entry that matches the key. MapValuePtrFromCursor resolves it to a value pointer. The map is not modified.
Failure
Returns MapValueCursorInvalid() when no entry exists for the key. The map is not modified.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Map.Access.c:112:
MapInsertR(&map, 9, 90);
cursor = MapFindFirstForKey(&map, 4);
while (MapValueCursorIsValid(cursor)) {
int *value_ptr = MapValuePtrFromCursor(&map, cursor);- In
Map.Access.c:127:
bool result = (seen == 3) && (value_sum == (40 + 41 + 42));
result = result && !MapValueCursorIsValid(MapFindFirstForKey(&map, 99));
result = result && (MapValuePtrFromCursor(&map, MapValueCursorInvalid()) == NULL);- In
Map.Access.c:144:
MapInsertR(&map, 5, 51);
cursor = MapFindFirstForKey(&map, 5);
if (!MapValueCursorIsValid(cursor)) {
MapDeinit(&map);
Last updated on