ucx/cx/hash_map.h

changeset 854
1c8401ece69e
parent 852
83fdf679df99
equal deleted inserted replaced
853:2ad93ebdc8d9 854:1c8401ece69e
67 /** 67 /**
68 * Creates a new hash map with the specified number of buckets. 68 * Creates a new hash map with the specified number of buckets.
69 * 69 *
70 * If @p buckets is zero, an implementation defined default will be used. 70 * If @p buckets is zero, an implementation defined default will be used.
71 * 71 *
72 * If @p elem_size is CX_STORE_POINTERS, the created map will be created as if 72 * If @p elem_size is #CX_STORE_POINTERS, the created map stores pointers instead of
73 * cxMapStorePointers() was called immediately after creation. 73 * copies of the added elements.
74 * 74 *
75 * @note Iterators provided by this hash map implementation provide the remove operation. 75 * @note Iterators provided by this hash map implementation provide the remove operation.
76 * The index value of an iterator is incremented when the iterator advanced without removal. 76 * The index value of an iterator is incremented when the iterator advanced without removal.
77 * In other words, when the iterator is finished, @c index==size . 77 * In other words, when the iterator is finished, @c index==size .
78 * 78 *
83 * @return a pointer to the new hash map 83 * @return a pointer to the new hash map
84 */ 84 */
85 cx_attr_nodiscard 85 cx_attr_nodiscard
86 cx_attr_malloc 86 cx_attr_malloc
87 cx_attr_dealloc(cxMapFree, 1) 87 cx_attr_dealloc(cxMapFree, 1)
88 cx_attr_export
88 CxMap *cxHashMapCreate( 89 CxMap *cxHashMapCreate(
89 const CxAllocator *allocator, 90 const CxAllocator *allocator,
90 size_t itemsize, 91 size_t itemsize,
91 size_t buckets 92 size_t buckets
92 ); 93 );
93 94
94 /** 95 /**
95 * Creates a new hash map with a default number of buckets. 96 * Creates a new hash map with a default number of buckets.
96 * 97 *
97 * If @p elem_size is CX_STORE_POINTERS, the created map will be created as if 98 * If @p elem_size is #CX_STORE_POINTERS, the created map stores pointers instead of
98 * cxMapStorePointers() was called immediately after creation. 99 * copies of the added elements.
99 * 100 *
100 * @note Iterators provided by this hash map implementation provide the remove operation. 101 * @note Iterators provided by this hash map implementation provide the remove operation.
101 * The index value of an iterator is incremented when the iterator advanced without removal. 102 * The index value of an iterator is incremented when the iterator advanced without removal.
102 * In other words, when the iterator is finished, @c index==size . 103 * In other words, when the iterator is finished, @c index==size .
103 * 104 *
124 * @param map the map to rehash 125 * @param map the map to rehash
125 * @retval zero success 126 * @retval zero success
126 * @retval non-zero if a memory allocation error occurred 127 * @retval non-zero if a memory allocation error occurred
127 */ 128 */
128 cx_attr_nonnull 129 cx_attr_nonnull
130 cx_attr_export
129 int cxMapRehash(CxMap *map); 131 int cxMapRehash(CxMap *map);
130 132
131 133
132 #ifdef __cplusplus 134 #ifdef __cplusplus
133 } // extern "C" 135 } // extern "C"

mercurial