/* * Erase a range of element in an hashtable. */ void _hashtable_erase_range( _hashtable_t* pt_hashtable, _hashtable_iterator_t it_begin, _hashtable_iterator_t it_end) { _hashtable_iterator_t it_iter; _hashtable_iterator_t it_next; assert(pt_hashtable != NULL); assert(_hashtable_is_inited(pt_hashtable)); assert(_hashtable_iterator_belong_to_hashtable(pt_hashtable, it_begin)); assert(_hashtable_iterator_belong_to_hashtable(pt_hashtable, it_end)); assert(_hashtable_iterator_equal(it_begin, it_end) || _hashtable_iterator_before(it_begin, it_end)); it_iter = it_next = it_begin; if(!_hashtable_iterator_equal(it_next, _hashtable_end(pt_hashtable))) { it_next = _hashtable_iterator_next(it_next); } while(!_hashtable_iterator_equal(it_iter, it_end)) { _hashtable_erase_pos(pt_hashtable, it_iter); it_iter = it_next; if(!_hashtable_iterator_equal(it_next, _hashtable_end(pt_hashtable))) { it_next = _hashtable_iterator_next(it_next); } } }
/* * Erase an element in an hash_set from specificed position. */ void hash_set_erase_pos(hash_set_t* phset_set, hash_set_iterator_t it_pos) { assert(phset_set != NULL); assert(_HASH_SET_ITERATOR_CONTAINER_TYPE(it_pos) == _HASH_SET_CONTAINER); assert(_HASH_SET_ITERATOR_ITERATOR_TYPE(it_pos) == _BIDIRECTIONAL_ITERATOR); assert(_HASH_SET_ITERATOR_CONTAINER(it_pos) == phset_set); _hashtable_erase_pos(&phset_set->_t_hashtable, it_pos); }
/** * Erase an element in an hash_multimap from specificed position. */ void hash_multimap_erase_pos(hash_multimap_t* phmmap_map, hash_multimap_iterator_t it_pos) { assert(phmmap_map != NULL); assert(_pair_is_inited(&phmmap_map->_pair_temp)); assert(_GET_HASH_MULTIMAP_CONTAINER_TYPE(it_pos) == _HASH_MULTIMAP_CONTAINER); assert(_GET_HASH_MULTIMAP_ITERATOR_TYPE(it_pos) == _BIDIRECTIONAL_ITERATOR); assert(_GET_HASH_MULTIMAP_CONTAINER(it_pos) == phmmap_map); _hashtable_erase_pos(&phmmap_map->_t_hashtable, it_pos); }