/** * Return an iterator range that is equal to a specific element. */ range_t _set_equal_range_varg(const set_t* cpset_set, va_list val_elemlist) { void* pv_varg = NULL; range_t r_range; assert(cpset_set != NULL); pv_varg = _alloc_allocate(&((set_t*)cpset_set)->_t_tree._t_allocator, _GET_SET_TYPE_SIZE(cpset_set), 1); assert(pv_varg != NULL); _set_get_varg_value_auxiliary((set_t*)cpset_set, val_elemlist, pv_varg); #ifdef CSTL_SET_AVL_TREE r_range = _avl_tree_equal_range(&cpset_set->_t_tree, pv_varg); #else r_range = _rb_tree_equal_range(&cpset_set->_t_tree, pv_varg); #endif _set_destroy_varg_value_auxiliary((set_t*)cpset_set, pv_varg); _alloc_deallocate(&((set_t*)cpset_set)->_t_tree._t_allocator, pv_varg, _GET_SET_TYPE_SIZE(cpset_set), 1); _ITERATOR_CONTAINER(r_range.it_begin) = (set_t*)cpset_set; _SET_ITERATOR_CONTAINER_TYPE(r_range.it_begin) = _SET_CONTAINER; _SET_ITERATOR_ITERATOR_TYPE(r_range.it_begin) = _BIDIRECTIONAL_ITERATOR; _ITERATOR_CONTAINER(r_range.it_end) = (set_t*)cpset_set; _SET_ITERATOR_CONTAINER_TYPE(r_range.it_end) = _SET_CONTAINER; _SET_ITERATOR_ITERATOR_TYPE(r_range.it_end) = _BIDIRECTIONAL_ITERATOR; return r_range; }
pair_t _multimap_equal_range_varg( const multimap_t* cpt_multimap, va_list val_elemlist) { multimap_iterator_t t_first; multimap_iterator_t t_second; pair_t t_pair; #ifdef CSTL_MULTIMAP_AVL_TREE avl_tree_result_pair_t t_avlresult; #else rb_tree_result_pair_t t_rbresult; #endif assert(cpt_multimap != NULL); _get_varg_value( cpt_multimap->_t_pair.first, val_elemlist, cpt_multimap->_t_pair._t_firsttypesize, cpt_multimap->_t_pair._sz_firsttypename); #ifdef CSTL_MULTIMAP_AVL_TREE t_avlresult = _avl_tree_equal_range( _GET_MULTIMAP_AVL_TREE(cpt_multimap), &cpt_multimap->_t_pair); t_first = t_avlresult._t_first; t_second = t_avlresult._t_second._t_iterator; #else t_rbresult = _rb_tree_equal_range( _GET_MULTIMAP_RB_TREE(cpt_multimap), &cpt_multimap->_t_pair); t_first = t_rbresult._t_first; t_second = t_rbresult._t_second._t_iterator; #endif _GET_CONTAINER(&t_first) = (multimap_t*)cpt_multimap; _GET_MULTIMAP_CONTAINER_TYPE(&t_first) = _MULTIMAP_CONTAINER; _GET_MULTIMAP_ITERATOR_TYPE(&t_first) = _BIDIRECTIONAL_ITERATOR; _GET_CONTAINER(&t_second) = (multimap_t*)cpt_multimap; _GET_MULTIMAP_CONTAINER_TYPE(&t_second) = _MULTIMAP_CONTAINER; _GET_MULTIMAP_ITERATOR_TYPE(&t_second) = _BIDIRECTIONAL_ITERATOR; t_pair = create_pair(multimap_iterator_t, multimap_iterator_t); pair_init(&t_pair); memcpy(t_pair.first, &t_first, t_pair._t_firsttypesize); memcpy(t_pair.second, &t_second, t_pair._t_secondtypesize); return t_pair; }
/** * Return an iterator range that is equal to a specific element. */ range_t _map_equal_range_varg(const map_t* cpmap_map, va_list val_elemlist) { range_t r_range; assert(cpmap_map != NULL); assert(_pair_is_inited(&cpmap_map->_pair_temp)); _type_get_varg_value(&((map_t*)cpmap_map)->_pair_temp._t_typeinfofirst, val_elemlist, cpmap_map->_pair_temp._pv_first); #ifdef CSTL_MAP_AVL_TREE r_range = _avl_tree_equal_range(&cpmap_map->_t_tree, &cpmap_map->_pair_temp); #else r_range = _rb_tree_equal_range(&cpmap_map->_t_tree, &cpmap_map->_pair_temp); #endif _ITERATOR_CONTAINER(r_range.it_begin) = (map_t*)cpmap_map; _MAP_ITERATOR_CONTAINER_TYPE(r_range.it_begin) = _MAP_CONTAINER; _MAP_ITERATOR_ITERATOR_TYPE(r_range.it_begin) = _BIDIRECTIONAL_ITERATOR; _ITERATOR_CONTAINER(r_range.it_end) = (map_t*)cpmap_map; _MAP_ITERATOR_CONTAINER_TYPE(r_range.it_end) = _MAP_CONTAINER; _MAP_ITERATOR_ITERATOR_TYPE(r_range.it_end) = _BIDIRECTIONAL_ITERATOR; return r_range; }