Example #1
0
/**
 * Return the number of specific elements in an map
 */
size_t _map_count_varg(const map_t* cpmap_map, va_list val_elemlist)
{
    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
    return _avl_tree_count(&cpmap_map->_t_tree, &cpmap_map->_pair_temp);
#else
    return _rb_tree_count(&cpmap_map->_t_tree, &cpmap_map->_pair_temp);
#endif
}
Example #2
0
size_t _map_count_varg(const map_t* cpt_map, va_list val_elemlist)
{
    assert(cpt_map != NULL);

    _get_varg_value(
        cpt_map->_t_pair.first,
        val_elemlist,
        cpt_map->_t_pair._t_firsttypesize,
        cpt_map->_t_pair._sz_firsttypename);
#ifdef CSTL_MAP_AVL_TREE
    return _avl_tree_count(_GET_MAP_AVL_TREE(cpt_map), &cpt_map->_t_pair);
#else
    return _rb_tree_count(_GET_MAP_RB_TREE(cpt_map), &cpt_map->_t_pair);
#endif
}
Example #3
0
/**
 * Return the number of specific elements in an set
 */
size_t _set_count_varg(const set_t* cpset_set, va_list val_elemlist)
{
    void*          pv_varg = NULL;
    size_t         t_count = 0;

    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
    t_count = _avl_tree_count(&cpset_set->_t_tree, pv_varg);
#else
    t_count = _rb_tree_count(&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);

    return t_count;
}