/** * Inserts an range of unique element into a hash_set. */ void hash_set_insert_range(hash_set_t* phset_set, iterator_t it_begin, iterator_t it_end) { assert(phset_set != NULL); assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end)); _hashtable_insert_unique_range(&phset_set->_t_hashtable, it_begin, it_end); }
/** * Initialize hash_set container with specific range and compare function. */ void hash_set_init_copy_range_ex(hash_set_t* phset_set, iterator_t it_begin, iterator_t it_end, size_t t_bucketcount, unary_function_t ufun_hash, binary_function_t bfun_compare) { assert(phset_set != NULL); assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end)); _hashtable_init_copy_unique_range(&phset_set->_t_hashtable, it_begin, it_end, t_bucketcount, ufun_hash, bfun_compare); }
/** * Initialize avl tree container with specific range. */ void _avl_tree_init_copy_equal_range(_avl_tree_t* pt_dest, iterator_t it_begin, iterator_t it_end) { assert(pt_dest != NULL); assert(_avl_tree_is_created(pt_dest)); assert(_avl_tree_same_iterator_type(pt_dest, it_begin)); assert(_avl_tree_same_iterator_type(pt_dest, it_end)); assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end)); _avl_tree_init(pt_dest, NULL); _avl_tree_insert_equal_range(pt_dest, it_begin, it_end); }
/** * Initialize avl tree container with specific range and compare function. */ void _avl_tree_init_copy_unique_range_ex(_avl_tree_t* pt_dest, iterator_t it_begin, iterator_t it_end, bfun_t t_compare) { assert(pt_dest != NULL); assert(_avl_tree_is_created(pt_dest)); assert(_avl_tree_same_iterator_type(pt_dest, it_begin)); assert(_avl_tree_same_iterator_type(pt_dest, it_end)); assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end)); _avl_tree_init(pt_dest, t_compare); _avl_tree_insert_unique_range(pt_dest, it_begin, it_end); }
/** * Inserts an range of element into a multiset. */ void multiset_insert_range(multiset_t* pmset_mset, iterator_t it_begin, iterator_t it_end) { assert(pmset_mset != NULL); assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end)); #ifdef CSTL_MULTISET_AVL_TREE _avl_tree_insert_equal_range(&pmset_mset->_t_tree, it_begin, it_end); #else _rb_tree_insert_equal_range(&pmset_mset->_t_tree, it_begin, it_end); #endif }
/** * Initialize multiset container with specific range and compare function. */ void multiset_init_copy_range_ex( multiset_t* pmset_dest, iterator_t it_begin, iterator_t it_end, binary_function_t bfun_compare) { assert(pmset_dest != NULL); assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end)); #ifdef CSTL_MULTISET_AVL_TREE _avl_tree_init_copy_equal_range_ex(&pmset_dest->_t_tree, it_begin, it_end, bfun_compare); #else _rb_tree_init_copy_equal_range_ex(&pmset_dest->_t_tree, it_begin, it_end, bfun_compare); #endif }
/** * Inserts an range of unique element into a hash_multimap. */ void hash_multimap_insert_range(hash_multimap_t* phmmap_map, iterator_t it_begin, iterator_t it_end) { iterator_t it_iter; assert(phmmap_map != NULL); assert(_pair_is_inited(&phmmap_map->_pair_temp)); assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end)); for (it_iter = it_begin; !iterator_equal(it_iter, it_end); it_iter = iterator_next(it_iter)) { assert(_hash_multimap_same_pair_type(&phmmap_map->_pair_temp, (pair_t*)iterator_get_pointer(it_iter))); hash_multimap_insert(phmmap_map, (pair_t*)iterator_get_pointer(it_iter)); } }
/** * 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 hashtable container with specific range. */ void _hashtable_init_copy_unique_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_unique_range(pt_dest, it_begin, it_end); }
/** * Inserts an range of unique element into a avl tree. */ void _avl_tree_insert_unique_range(_avl_tree_t* pt_avl_tree, iterator_t it_begin, iterator_t it_end) { iterator_t it_iter; assert(pt_avl_tree != NULL); assert(_avl_tree_is_inited(pt_avl_tree)); assert(_avl_tree_same_iterator_type(pt_avl_tree, it_begin)); assert(_avl_tree_same_iterator_type(pt_avl_tree, it_end)); assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end)); for (it_iter = it_begin; !iterator_equal(it_iter, it_end); it_iter = iterator_next(it_iter)) { _avl_tree_insert_unique(pt_avl_tree, _iterator_get_pointer_ignore_cstr(it_iter)); } }
/** * Inserts an range into a hashtable. */ void _hashtable_insert_equal_range(_hashtable_t* pt_hashtable, iterator_t it_begin, iterator_t it_end) { iterator_t it_iter; assert(pt_hashtable != NULL); assert(_hashtable_is_inited(pt_hashtable)); assert(_hashtable_same_iterator_type(pt_hashtable, it_begin)); assert(_hashtable_same_iterator_type(pt_hashtable, it_end)); assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end)); for (it_iter = it_begin; !iterator_equal(it_iter, it_end); it_iter = iterator_next(it_iter)) { _hashtable_insert_equal(pt_hashtable, _iterator_get_pointer_ignore_cstr(it_iter)); } }
/** * Test whether the [it_first, it_end) is valid range. */ bool_t _iterator_valid_range(iterator_t it_first, iterator_t it_end, iteratortype_t t_type) { return _iterator_same_type(it_first, it_end) && _iterator_limit_type(it_first, t_type) && (iterator_equal(it_first, it_end) || _iterator_before(it_first, it_end)); }