Пример #1
0
/**
 * Erase an element from a map that match a specified element.
 */
size_t _map_erase_varg(map_t* pmap_map, va_list val_elemlist)
{
    assert(pmap_map != NULL);
    assert(_pair_is_inited(&pmap_map->_pair_temp));

    /* get key */
    _type_get_varg_value(&pmap_map->_pair_temp._t_typeinfofirst, val_elemlist, pmap_map->_pair_temp._pv_first);
#ifdef CSTL_MAP_AVL_TREE
    return _avl_tree_erase(&pmap_map->_t_tree, &pmap_map->_pair_temp);
#else
    return _rb_tree_erase(&pmap_map->_t_tree, &pmap_map->_pair_temp);
#endif
}
Пример #2
0
size_t _map_erase_varg(map_t* pt_map, va_list val_elemlist)
{
    assert(pt_map != NULL);

    /* get key */
    _get_varg_value(
        pt_map->_t_pair.first,
        val_elemlist,
        pt_map->_t_pair._t_firsttypesize,
        pt_map->_t_pair._sz_firsttypename);
#ifdef CSTL_MAP_AVL_TREE
    return _avl_tree_erase(_GET_MAP_AVL_TREE(pt_map), &pt_map->_t_pair);
#else
    return _rb_tree_erase(_GET_MAP_RB_TREE(pt_map), &pt_map->_t_pair);
#endif
}
Пример #3
0
/**
 * Erase an element from a set that match a specified element.
 */
size_t _set_erase_varg(set_t* pset_set, va_list val_elemlist)
{
    void*          pv_varg = NULL;
    size_t         t_count = 0;

    assert(pset_set != NULL);

    pv_varg = _alloc_allocate(&pset_set->_t_tree._t_allocator, _GET_SET_TYPE_SIZE(pset_set), 1);
    assert(pv_varg != NULL);
    _set_get_varg_value_auxiliary(pset_set, val_elemlist, pv_varg);

#ifdef CSTL_SET_AVL_TREE
    t_count = _avl_tree_erase(&pset_set->_t_tree, pv_varg);
#else
    t_count = _rb_tree_erase(&pset_set->_t_tree, pv_varg);
#endif

    _set_destroy_varg_value_auxiliary(pset_set, pv_varg);
    _alloc_deallocate(&pset_set->_t_tree._t_allocator, pv_varg, _GET_SET_TYPE_SIZE(pset_set), 1);

    return t_count;
}