/** * Find specific element. */ map_iterator_t _map_find(const map_t* cpmap_map, ...) { map_iterator_t it_iter; va_list val_elemlist; va_start(val_elemlist, cpmap_map); it_iter = _map_find_varg(cpmap_map, val_elemlist); va_end(val_elemlist); return it_iter; }
/** * Access an element with specific index. */ void* _map_at_varg(map_t* pmap_map, va_list val_elemlist) { map_iterator_t it_iter; va_list val_elemlist_copy; assert(pmap_map != NULL); assert(_pair_is_inited(&pmap_map->_pair_temp)); va_copy(val_elemlist_copy, val_elemlist); _type_get_varg_value(&pmap_map->_pair_temp._t_typeinfofirst, val_elemlist, pmap_map->_pair_temp._pv_first); #ifdef CSTL_MAP_AVL_TREE it_iter = _avl_tree_insert_unique(&pmap_map->_t_tree, &pmap_map->_pair_temp); #else it_iter = _rb_tree_insert_unique(&pmap_map->_t_tree, &pmap_map->_pair_temp); #endif _ITERATOR_CONTAINER(it_iter) = pmap_map; _MAP_ITERATOR_CONTAINER_TYPE(it_iter) = _MAP_CONTAINER; _MAP_ITERATOR_ITERATOR_TYPE(it_iter) = _BIDIRECTIONAL_ITERATOR; if(iterator_equal(it_iter, map_end(pmap_map))) { it_iter = _map_find_varg(pmap_map, val_elemlist_copy); } va_end(val_elemlist_copy); /* char* */ if(strncmp(_GET_MAP_SECOND_TYPE_BASENAME(pmap_map), _C_STRING_TYPE, _TYPE_NAME_SIZE) == 0) { return (char*)string_c_str((string_t*)((pair_t*)iterator_get_pointer(it_iter))->_pv_second); } else { return ((pair_t*)iterator_get_pointer(it_iter))->_pv_second; } }
map_iterator_t _map_find(const map_t* cpt_map, ...) { va_list val_elemlist; va_start(val_elemlist, cpt_map); return _map_find_varg(cpt_map, val_elemlist); }