Esempio n. 1
0
multimap_iterator_t _multimap_lower_bound_varg(
    const multimap_t* cpt_multimap, va_list val_elemlist)
{
    multimap_iterator_t t_iterator;

    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_iterator = _avl_tree_lower_bound(
        _GET_MULTIMAP_AVL_TREE(cpt_multimap), &cpt_multimap->_t_pair);
#else
    t_iterator = _rb_tree_lower_bound(
        _GET_MULTIMAP_RB_TREE(cpt_multimap), &cpt_multimap->_t_pair);
#endif

    _GET_CONTAINER(&t_iterator) = (multimap_t*)cpt_multimap;
    _GET_MULTIMAP_CONTAINER_TYPE(&t_iterator) = _MULTIMAP_CONTAINER;
    _GET_MULTIMAP_ITERATOR_TYPE(&t_iterator) = _BIDIRECTIONAL_ITERATOR;

    return t_iterator;
}
Esempio n. 2
0
/**
 * Return an iterator to the first element that is equal to or greater than a specific element.
 */
set_iterator_t _set_lower_bound_varg(const set_t* cpset_set, va_list val_elemlist)
{
    void*          pv_varg = NULL;
    set_iterator_t it_iter;

    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
    it_iter = _avl_tree_lower_bound(&cpset_set->_t_tree, pv_varg);
#else
    it_iter = _rb_tree_lower_bound(&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(it_iter) = (set_t*)cpset_set;
    _SET_ITERATOR_CONTAINER_TYPE(it_iter) = _SET_CONTAINER;
    _SET_ITERATOR_ITERATOR_TYPE(it_iter) = _BIDIRECTIONAL_ITERATOR;

    return it_iter;
}
Esempio n. 3
0
/**
 * Return an iterator to the first element that is equal to or greater than a specific element.
 */
map_iterator_t _map_lower_bound_varg(const map_t* cpmap_map, va_list val_elemlist)
{
    map_iterator_t it_iter;

    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
    it_iter = _avl_tree_lower_bound(&cpmap_map->_t_tree, &cpmap_map->_pair_temp);
#else
    it_iter = _rb_tree_lower_bound(&cpmap_map->_t_tree, &cpmap_map->_pair_temp);
#endif

    _ITERATOR_CONTAINER(it_iter) = (map_t*)cpmap_map;
    _MAP_ITERATOR_CONTAINER_TYPE(it_iter) = _MAP_CONTAINER;
    _MAP_ITERATOR_ITERATOR_TYPE(it_iter) = _BIDIRECTIONAL_ITERATOR;

    return it_iter;
}