/** * Initialize hash_multimap container with specific array and compare function. */ void hash_multimap_init_copy_array_ex(hash_multimap_t* phmmap_dest, const void* cpv_array, size_t t_count, size_t t_bucketcount, ufun_t ufun_hash, bfun_t bfun_compare) { ufun_t ufun_default_hash = NULL; assert(phmmap_dest != NULL); assert(_pair_is_created(&phmmap_dest->_pair_temp)); assert(cpv_array != NULL); ufun_default_hash = ufun_hash != NULL ? ufun_hash : _hash_multimap_default_hash; hash_multimap_init_ex(phmmap_dest, t_bucketcount, ufun_default_hash, bfun_compare); hash_multimap_insert_array(phmmap_dest, cpv_array, t_count); }
/** * Initialize hash_multimap container with specific range and compare function. */ void hash_multimap_init_copy_range_ex(hash_multimap_t* phmmap_dest, iterator_t it_begin, iterator_t it_end, size_t t_bucketcount, ufun_t ufun_hash, bfun_t bfun_compare) { ufun_t ufun_default_hash = NULL; assert(phmmap_dest != NULL); assert(_pair_is_created(&phmmap_dest->_pair_temp)); assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end)); ufun_default_hash = ufun_hash != NULL ? ufun_hash : _hash_multimap_default_hash; hash_multimap_init_ex(phmmap_dest, t_bucketcount, ufun_default_hash, bfun_compare); hash_multimap_insert_range(phmmap_dest, it_begin, it_end); }
/** * Initialize hash_multimap container with hash_multimap. */ void hash_multimap_init_copy(hash_multimap_t* phmmap_dest, const hash_multimap_t* cphmmap_src) { assert(phmmap_dest != NULL); assert(cphmmap_src != NULL); assert(_pair_is_created(&phmmap_dest->_pair_temp)); assert(_pair_is_inited(&cphmmap_src->_pair_temp)); hash_multimap_init_ex(phmmap_dest, hash_multimap_bucket_count(cphmmap_src), hash_multimap_hash(cphmmap_src), hash_multimap_key_comp(cphmmap_src)); phmmap_dest->_bfun_keycompare = cphmmap_src->_bfun_keycompare; phmmap_dest->_bfun_valuecompare = cphmmap_src->_bfun_valuecompare; phmmap_dest->_pair_temp._bfun_mapkeycompare = cphmmap_src->_pair_temp._bfun_mapkeycompare; phmmap_dest->_pair_temp._bfun_mapvaluecompare = cphmmap_src->_pair_temp._bfun_mapvaluecompare; assert(_hash_multimap_same_pair_type_ex(&phmmap_dest->_pair_temp, &cphmmap_src->_pair_temp)); if (!hash_multimap_empty(cphmmap_src)) { hash_multimap_insert_range(phmmap_dest, hash_multimap_begin(cphmmap_src), hash_multimap_end(cphmmap_src)); } }
/** * Initialize hash_multimap container with specific range and compare function. */ void hash_multimap_init_copy_range_ex( hash_multimap_t* phmmap_dest, hash_multimap_iterator_t it_begin, hash_multimap_iterator_t it_end, size_t t_bucketcount, unary_function_t ufun_hash, binary_function_t bfun_compare) { unary_function_t ufun_default_hash = NULL; assert(phmmap_dest != NULL); assert(_GET_HASH_MULTIMAP_CONTAINER_TYPE(it_begin) == _HASH_MULTIMAP_CONTAINER); assert(_GET_HASH_MULTIMAP_ITERATOR_TYPE(it_begin) == _BIDIRECTIONAL_ITERATOR); assert(_GET_HASH_MULTIMAP_CONTAINER_TYPE(it_end) == _HASH_MULTIMAP_CONTAINER); assert(_GET_HASH_MULTIMAP_ITERATOR_TYPE(it_end) == _BIDIRECTIONAL_ITERATOR); assert(_GET_HASH_MULTIMAP_CONTAINER(it_begin) != phmmap_dest); assert(_GET_HASH_MULTIMAP_CONTAINER(it_end) != phmmap_dest); assert(_GET_HASH_MULTIMAP_CONTAINER(it_begin) == _GET_HASH_MULTIMAP_CONTAINER(it_end)); assert(_hash_multimap_same_pair_type(&phmmap_dest->_pair_temp, &_GET_HASH_MULTIMAP_CONTAINER(it_begin)->_pair_temp)); ufun_default_hash = ufun_hash != NULL ? ufun_hash : _hash_multimap_default_hash; hash_multimap_init_ex(phmmap_dest, t_bucketcount, ufun_default_hash, bfun_compare); if(!hash_multimap_empty(_GET_HASH_MULTIMAP_CONTAINER(it_begin))) { hash_multimap_insert_range(phmmap_dest, it_begin, it_end); } }
/** * Initialize hash_multimap container. */ void hash_multimap_init(hash_multimap_t* phmmap_map) { hash_multimap_init_ex(phmmap_map, 0, NULL, NULL); }