예제 #1
0
void map_swap(map_t* pt_mapfirst, map_t* pt_mapsecond)
{
    assert(pt_mapfirst != NULL && pt_mapsecond != NULL);
    assert(_same_map_pair_type(&pt_mapfirst->_t_pair, &pt_mapsecond->_t_pair));

#ifdef CSTL_MAP_AVL_TREE
    _avl_tree_swap(_GET_MAP_AVL_TREE(pt_mapfirst), _GET_MAP_AVL_TREE(pt_mapsecond));
#else
    _rb_tree_swap(_GET_MAP_RB_TREE(pt_mapfirst), _GET_MAP_RB_TREE(pt_mapsecond));
#endif
}
예제 #2
0
/**
 * Swap the datas of first multiset and second multiset.
 */
void multiset_swap(multiset_t* pmset_first, multiset_t* pmset_second)
{
    assert(pmset_first != NULL);
    assert(pmset_second != NULL);

#ifdef CSTL_MULTISET_AVL_TREE
    _avl_tree_swap(&pmset_first->_t_tree, &pmset_second->_t_tree);
#else
    _rb_tree_swap(&pmset_first->_t_tree, &pmset_second->_t_tree);
#endif
}
예제 #3
0
/**
 * Swap the datas of first set and second set.
 */
void set_swap(set_t* pset_first, set_t* pset_second)
{
    assert(pset_first != NULL);
    assert(pset_second != NULL);

#ifdef CSTL_SET_AVL_TREE
    _avl_tree_swap(&pset_first->_t_tree, &pset_second->_t_tree);
#else
    _rb_tree_swap(&pset_first->_t_tree, &pset_second->_t_tree);
#endif
}
예제 #4
0
/**
 * Swap the datas of first map and second map.
 */
void map_swap(map_t* pmap_first, map_t* pmap_second)
{
    assert(pmap_first != NULL);
    assert(pmap_second != NULL);
    assert(_pair_is_inited(&pmap_first->_pair_temp));
    assert(_pair_is_inited(&pmap_second->_pair_temp));
    assert(_map_same_pair_type_ex(&pmap_first->_pair_temp, &pmap_second->_pair_temp));

#ifdef CSTL_MAP_AVL_TREE
    _avl_tree_swap(&pmap_first->_t_tree, &pmap_second->_t_tree);
#else
    _rb_tree_swap(&pmap_first->_t_tree, &pmap_second->_t_tree);
#endif
}