C Collections

cbstmap · Section 3

cbstmap_create_mp

cbstmap_create_mp - create a BST map with custom memory management procedures

C Collections (libccollections, -lccollections)

#include <ccollections/cbstmap.h>
 
cbmap cbstmap_create_mp(ccol_data_type key_type,
                        ccol_memmgmt_procs *mmgmt_procs, char **err);

Creates a self-balancing BST map that allocates through the given memory
management procedures. It is a thin inline wrapper over
cbstmap_create_full(3) that passes NULL for the custom comparison procedure,
so the keys get the default order for key_type that cbstmap_create(3)
describes.
 
Every allocation the map makes after it is created goes through these
procedures, the allocations of an iterator over the map included, so
destroy the map while the procedures are valid.

key_type     Type of the keys that the map stores
mmgmt_procs  Memory management procedures, or NULL for the default
             allocator
err          Optional pointer that receives an error string on failure,
             or NULL

A new map on success. On failure it returns NULL and, when err is not
NULL, sets *err to an error string.

This function reports a failure to the caller, while the
cbmap_construct_mp(3) and cbmap_init_mp(3) macros call ccol__fatal_err()
on a failure. Destroy the map with cbmap_destroy(3).

cbstmap_create(3), cbstmap_create_full(3), cbmap_construct_mp(3), cbmap_init_mp(3), cbmap_destroy(3), ccol_determine_ccol_data_type(3)