mg_map_insert2

Inserts the given key-value pair into the map.

A check is performed to see if the given key is unique in the map which means that a number of key comparisons equal to the current number of elements in the map is made.

If the key already exists in map, or the map's capacity is exhausted, the insertion will fail. If insertion fails, the map doesn't take ownership of key and value.

If the insertion is successful, map takes ownership of key and value.

extern (C) @safe @nogc pure nothrow
int
mg_map_insert2

Parameters

key mg_string*

A mg_string to be used as key.

value mg_value*

Value to be inserted.

Return: The function returns non-zero value if insertion failed, zero otherwise.

Meta