Skip to content

MapInsertL

MapInsertL

Description

Insert a new key/value pair using l-value semantics. Duplicate keys are allowed and append another value for the same key.

Ownership of key and value is transferred to the map if the corresponding copy-init callbacks are not set.

Parameters

Name Direction Description
m in,out Hash map.
key in Key to insert.
value in Value to insert.

Usage example (Cross-references)

Usage examples (Cross-references)
        int       value = 84;
    
        MapInsertL(&map, key, value);
    
        bool result = (key == 0) && (value == 0);
        int          value_count = 0;
    
        MapInsertL(&map, key, value);
        MapInsertL(&map, key, second_value);
    
        MapInsertL(&map, key, value);
        MapInsertL(&map, key, second_value);
    
        bool result         = (key == key_buf) && (value == value_buf) && (second_value == second_value_buf);
    /// Insert by default behaves like `MapInsertL`.
    ///
    #define MapInsert(m, in_key, in_value) MapInsertL((m), (in_key), (in_value))
    
    ///
Last updated on