--- a/docs/Writerside/topics/map.h.md Sat Dec 13 12:09:58 2025 +0100 +++ b/docs/Writerside/topics/map.h.md Sat Dec 13 12:24:35 2025 +0100 @@ -284,6 +284,21 @@ It is always safe to call the above functions on a `NULL`-pointer. In that case, the returned iterator will behave like an iterator over an empty map. +## Compare + +```C +#include <cx/map.h> + +int cxMapCompare(const CxMap *map, const CxMap *other); +``` + +Arbitrary maps can be compared with `cxMapCompare()`. +That means, for example, you can compare a [hash map](hash_map.h.md) with the map aspect of a [key/value list](kv_list.h.md). + +The return value of `cxMapCompare()` is zero if the lists contain the same keys and their values are pairwise equivalent, according to the map's compare function. +If the `map` contains fewer keys than the `other` map, the function returns a negative value, and if it contains more values, it returns a positive value, respectively. +When both maps contain the same number of keys but differ in either a key or a value, the return value is non-zero, but otherwise unspecified. + ## Clone ```C