Skip to content

MapSetFirstR

Description

Update the value of the first existing entry that matches in_key, or insert a new entry if no match exists. R-value form.

Success

Returns true. Same state effects as MapSetFirstL minus the value-source zeroing step; the value source is left untouched.

Failure

Returns false on allocation failure during a new-entry insert path. Existing entries are unchanged.

Usage example (Cross-references)

Usage examples (Cross-references)
        MapInsertR(&map, 1, 11);
        MapInsertR(&map, 1, 12);
        MapSetFirstR(&map, 1, 100);
    
        bool result = (MapPairCount(&map) == 3);
    #define MapMustSetFirstR(m, in_key, in_value)                                                                          \
        do {                                                                                                               \
            if (!MapSetFirstR((m), (in_key), (in_value))) {                                                                \
                LOG_FATAL("MapMustSetFirstR failed");                                                                      \
            }                                                                                                              \
Last updated on