/** * Initialize hashtable container with specific range. */ void _hashtable_init_copy_equal_range( _hashtable_t* pt_dest, iterator_t it_begin, iterator_t it_end, size_t t_bucketcount, ufun_t ufun_hash, bfun_t bfun_compare) { assert(pt_dest != NULL); assert(_hashtable_is_created(pt_dest)); assert(_hashtable_same_iterator_type(pt_dest, it_begin)); assert(_hashtable_same_iterator_type(pt_dest, it_end)); assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end)); _hashtable_init(pt_dest, t_bucketcount, ufun_hash, bfun_compare); _hashtable_insert_equal_range(pt_dest, it_begin, it_end); }
/** * Assign hashtable container. */ void _hashtable_assign(_hashtable_t* pt_dest, const _hashtable_t* cpt_src) { assert(pt_dest != NULL); assert(cpt_src != NULL); assert(_hashtable_is_inited(pt_dest)); assert(_hashtable_is_inited(cpt_src)); assert(_hashtable_same_type_ex(pt_dest, cpt_src)); /* clear all elements */ _hashtable_clear(pt_dest); /* insert node from src to dest */ if(!_hashtable_empty(cpt_src)) { _hashtable_insert_equal_range(pt_dest, _hashtable_begin(cpt_src), _hashtable_end(cpt_src)); } }
/** * Initialize hashtable container with hashtable. */ void _hashtable_init_copy(_hashtable_t* pt_dest, const _hashtable_t* cpt_src) { assert(pt_dest != NULL); assert(cpt_src != NULL); assert(_hashtable_is_created(pt_dest)); assert(_hashtable_is_inited(cpt_src)); assert(_hashtable_same_type(pt_dest, cpt_src)); /* initialize the dest hashtable with src hashtable attribute */ _hashtable_init(pt_dest, _hashtable_bucket_count(cpt_src), cpt_src->_ufun_hash, cpt_src->_bfun_compare); /* insert node from src to dest */ if(!_hashtable_empty(cpt_src)) { _hashtable_insert_equal_range(pt_dest, _hashtable_begin(cpt_src), _hashtable_end(cpt_src)); } }
/** * Initialize hashtable container with specific range. */ void _hashtable_init_copy_range( _hashtable_t* pt_dest, _hashtable_iterator_t it_begin, _hashtable_iterator_t it_end, size_t t_bucketcount, unary_function_t ufun_hash, binary_function_t bfun_compare) { assert(pt_dest != NULL); assert(_hashtable_is_created(pt_dest)); assert(_hashtable_same_hashtable_iterator_type(pt_dest, it_begin)); assert(_hashtable_same_hashtable_iterator_type(pt_dest, it_end)); assert(_hashtable_iterator_equal(it_begin, it_end) || _hashtable_iterator_before(it_begin, it_end)); /* initialize the dest hashtable with src hashtable attribute */ _hashtable_init(pt_dest, t_bucketcount, ufun_hash, bfun_compare); /* insert node from src to dest */ if(!_hashtable_empty(_GET_HASHTABLE(it_begin))) { _hashtable_insert_equal_range(pt_dest, it_begin, it_end); } }