Skip to content
MapValueCursorIsValid

MapValueCursorIsValid

Description

Check whether a cursor still points to a value for its key (i.e. the per-key iteration has not yet been exhausted).

Parameters

Name Direction Description
cursor in Cursor returned by MapFindFirstForKey or MapFindNextForKey.

Success

Returns true when cursor refers to an in-range entry (i.e. it is not the past-the-end sentinel). No map is touched.

Failure

Returns false when cursor equals MapValueCursorInvalid(), meaning the per-key iteration is done. No map is touched.

Usage example (Cross-references)

Usage examples (Cross-references)
    
        cursor = MapFindFirstForKey(&map, 4);
        while (MapValueCursorIsValid(cursor)) {
            int *value_ptr = MapValuePtrFromCursor(&map, cursor);
            if (!value_ptr) {
    
        bool result = (seen == 3) && (value_sum == (40 + 41 + 42));
        result      = result && !MapValueCursorIsValid(MapFindFirstForKey(&map, 99));
        result      = result && (MapValuePtrFromCursor(&map, MapValueCursorInvalid()) == NULL);
    
        cursor = MapFindFirstForKey(&map, 5);
        if (!MapValueCursorIsValid(cursor)) {
            MapDeinit(&map);
            DefaultAllocatorDeinit(&alloc);
Last updated on