Skip to content

MapInsert

Description

Default insert aliases the L-form: store a new (key, value) entry in the map, taking ownership of both in_key and in_value when their respective copy_init handler is absent.

Parameters

Name Direction Description
m in,out Map handle.
in_key in Addressable key. Must match the map’s key type.
in_value in Addressable value. Must match the map’s value type.

Success

Returns true; map length grows by one.

Failure

Returns false on allocation failure or policy violation; the map and both sources are unchanged.

Usage example (Cross-references)

Usage examples (Cross-references)
    #define MapMustInsert(m, in_key, in_value)                                                                             \
        do {                                                                                                               \
            if (!MapInsert((m), (in_key), (in_value))) {                                                                   \
                LOG_FATAL("MapMustInsert failed");                                                                         \
            }                                                                                                              \
Last updated on