Skip to content
MapValueCursorInvalid

MapValueCursorInvalid

Description

Sentinel cursor representing past-the-end / iteration exhausted. Returned by MapFindFirstForKey and MapFindNextForKey when no (further) entries match the queried key.

Success

Returns a MapValueCursor value that compares unequal to every cursor that points to an occupied entry. Suitable as the loop terminator for per-key cursor iteration. No map is touched.

Failure

Macro cannot fail. Has no map argument and no observable failure mode.

Usage example (Cross-references)

Usage examples (Cross-references)
        DefaultAllocator alloc     = DefaultAllocatorInit();
        IntIntMap        map       = MapInit(i32_hash, i32_compare, &alloc);
        MapValueCursor   cursor    = MapValueCursorInvalid();
        int              value_sum = 0;
        int              seen      = 0;
        bool result = (seen == 3) && (value_sum == (40 + 41 + 42));
        result      = result && !MapValueCursorIsValid(MapFindFirstForKey(&map, 99));
        result      = result && (MapValuePtrFromCursor(&map, MapValueCursorInvalid()) == NULL);
    
        MapDeinit(&map);
        DefaultAllocator alloc  = DefaultAllocatorInit();
        IntIntMap        map    = MapInit(i32_hash, i32_compare, &alloc);
        MapValueCursor   cursor = MapValueCursorInvalid();
    
        MapInsertR(&map, 5, 50);
Last updated on