Esempio n. 1
0
static BOOL __map_containsKey(Map *map, void *key){
	Iterator target, map_end;
	target = c_map_find(&map->values, key);
	map_end = c_map_end(&map->values);
	if( !ITER_EQUAL(map_end ,target ))
		return TRUE;
	else return FALSE;
}
Esempio n. 2
0
static void __map_remove(Map *map, void *key){
	Iterator target, map_end;
	target = c_map_find(&map->values, key);
	map_end = c_map_end(&map->values);
	if(!ITER_EQUAL(map_end, target))
	{
		c_map_erase(&map->values, target);
	}
}
Esempio n. 3
0
static int test_reverse_find_erase(c_pmap thiz)
{
	int j = 0;
	for(j = sizeof(keys) / sizeof(int) - 1; j >= 0; -- j)
	{
		c_iterator target, map_end;	
		printf("j = %d\n", j);

		target = c_map_find(thiz, &keys[j]); // set same as map
		
		map_end = c_map_end(thiz);
		if(!ITER_EQUAL(map_end, target))
		{			
			printf("to erase : %d\n", *(int*)(((c_ppair)ITER_REF(target))->first));
			assert_valid_iter(thiz, target);
			c_map_erase(thiz, target);
			assert(__c_rb_tree_verify(thiz->_l));
		}			
	}
	return 0;	
}