本文整理汇总了C++中delete_element函数的典型用法代码示例。如果您正苦于以下问题:C++ delete_element函数的具体用法?C++ delete_element怎么用?C++ delete_element使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_element函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: if
chooser::pitem chooser::delete_element(pitem p) {
pitem res = nullptr;
if (!p->L && !p->R) {
if (p->parent) {
res = p->parent;
if (is_left_child(p)) {
res->L = nullptr;
} else {
res->R = nullptr;
}
}
delete p;
} else if (!p->L || !p->R) {
if (p->parent) {
res = p->parent;
if (is_left_child(p)) {
res->L = p->L ? p->L : p->R;
} else {
res->R = p->L ? p->L : p->R;
}
p->L = p->R = nullptr;
delete p;
} else {
if (p->L) {
right_rotale(p);
} else {
left_rotale(p);
}
return delete_element(p);
}
} else {
pitem q = leftmost_child(p->R);
if (q != p->R) {
std::swap(p->L, q->L);
std::swap(p->R, q->R);
recalc(p);
recalc(q);
const pitem p_par = p->parent;
make_parent(q->parent, p);
make_parent(p_par, q);
} else {
left_rotale(p);
}
assert(!p->L || !p->R);
delete_element(p);
res = q->parent ? q->parent : q;
}
recalc(res);
return splay(res);
}
开发者ID:Break-Neck,项目名称:ant_algo,代码行数:50,代码来源:chooser.cpp
示例2: main
int main()
{
int option;
printf("\n");
printf(">>> c program to implement queue operations <<<");
do
{
printf("\n\n 1.Insert an element");
printf("\n 2.Delete an element");
printf("\n 3.Display queue");
printf("\n 4.Exit");
printf("\n Enter your choice: ");
scanf("%d",&option);
switch(option)
{
case 1: insert_element();
break;
case 2: delete_element();
break;
case 3: display_queue();
break;
case 4: return 0;
}
}while(option!=4);
}
开发者ID:venugopalvishwanathula,项目名称:my-cprograms,代码行数:26,代码来源:queue.c
示例3: delete_match_entry
void
delete_match_entry( struct ofp_match *ofp_match ) {
match_entry *delete_entry;
list_element *list;
pthread_mutex_lock( match_table_head.mutex );
assert( ofp_match != NULL );
if ( !ofp_match->wildcards ) {
delete_entry = delete_hash_entry( match_table_head.exact_table, ofp_match );
if ( delete_entry == NULL ) {
pthread_mutex_unlock( match_table_head.mutex );
return;
}
}
else {
for ( list = match_table_head.wildcard_table; list != NULL; list = list->next ) {
delete_entry = list->data;
if ( ( ( ( delete_entry->ofp_match.wildcards ^ ofp_match->wildcards ) & OFPFW_ALL ) == 0 )
&& compare_match( &delete_entry->ofp_match, ofp_match ) ) {
break;
}
}
if ( list == NULL ) {
pthread_mutex_unlock( match_table_head.mutex );
return;
}
delete_element( &match_table_head.wildcard_table, delete_entry );
}
free_match_entry( delete_entry );
pthread_mutex_unlock( match_table_head.mutex );
}
开发者ID:n-tada,项目名称:trema,代码行数:32,代码来源:match_table.c
示例4: main
int main()
{
Sant* santi=(Sant*)malloc(sizeof(Sant));
initializeSent(santi);
//santi->head=NULL;
// santi->tail=NULL;
char s[30];
int x;
out=fopen("out.txt","w");
in=fopen("in.txt","r");
int c;
c=fscanf(in,"%s %d",s,&x);
while(c>0)
{
//printf("%s %d\n",s,x);
if(!strcmp(s,"AL"))addLast(santi,x);
if(!strcmp(s,"AF"))addFirst(santi,x);
if(!strcmp(s,"DE"))delete_element(santi,x);
if(!strcmp(s,"PRINT_F"))print_first(santi,x);
if(!strcmp(s,"PRINT_L"))print_last(santi,x);
if(!strcmp(s,"PRINT_ALL"))printlist(santi);
if(!strcmp(s,"DOOM_THE_LIST"))doom_the_list(santi);
if(!strcmp(s,"DF"))delete_first(santi);
if(!strcmp(s,"DL"))delete_last(santi);
strcpy(s,"");
c=fscanf(in,"%s %d",s,&x);
}
return 0;
}
开发者ID:Alecs94,项目名称:DSA-lab,代码行数:30,代码来源:main1.c
示例5: delete_texture
void delete_texture(void **texs, void *tex) {
Texture *t = (Texture *)tex;
free(t->name);
glDeleteTextures(1, &t->gltex);
delete_element((void **)texs, tex);
}
开发者ID:miton,项目名称:taisei,代码行数:7,代码来源:texture.c
示例6: handle_packet_in
static void
handle_packet_in( uint64_t datapath_id, uint32_t transaction_id,
uint32_t buffer_id, uint16_t total_len,
uint16_t in_port, uint8_t reason, const buffer *data,
void *user_data ) {
services *services = user_data;
list_element **list_head = &services->arp_or_unicast;
packet_info *packet_info = data->user_data;
if ( !packet_type_arp( data ) && ( packet_info->eth_macda[ 0 ] & 0x1 ) == 0x1 ) {
list_head = &services->broadcast;
}
if ( *list_head == NULL ) {
return;
}
buffer *buf = create_packet_in( transaction_id, buffer_id, total_len, in_port,
reason, data );
openflow_service_header_t *message;
message = append_front_buffer( buf, sizeof( openflow_service_header_t ) );
message->datapath_id = htonll( datapath_id );
message->service_name_length = htons( 0 );
char *service_name = ( *list_head )->data;
if ( send_message( service_name, MESSENGER_OPENFLOW_MESSAGE, buf->data, buf->length ) ) {
debug( "Sending a message to %s.", service_name );
}
free_buffer( buf );
if ( ( *list_head )->next != NULL ) {
//round robin
delete_element( list_head, service_name );
append_to_tail( list_head, service_name );
}
}
开发者ID:iqm,项目名称:apps,代码行数:33,代码来源:packetin_dispatcher.c
示例7: delete_packetin_match_entry
static int
delete_packetin_match_entry( struct ofp_match match, uint16_t priority, const char *service_name ) {
list_element *head = delete_match_strict_entry( match, priority );
if ( head == NULL ) {
return 0;
}
int n_deleted = 0;
int n_remaining_services = 0;
list_element *services = head;
while ( services != NULL ) {
char *service = services->data;
services = services->next;
if ( strcmp( service, service_name ) == 0 ) {
delete_element( &head, service );
xfree( service );
n_deleted++;
}
else {
n_remaining_services++;
}
}
if ( n_remaining_services == 0 ) {
if ( head != NULL ) {
delete_list( head );
}
}
else {
insert_match_entry( match, priority, head );
}
return n_deleted;
}
开发者ID:Milstein,项目名称:trema,代码行数:34,代码来源:packetin_filter.c
示例8: loop_exit
int loop_exit(loop_handle *hd)
{
int i;
hd->running = FALSE;
if(hd->svdst != NULL) {
if (hd->fifodst != NULL) {
sv_fifo_free(hd->svdst, hd->fifodst);
hd->fifodst = NULL;
}
if(hd->svdst != hd->svsrc) {
sv_close(hd->svdst);
hd->svdst = NULL;
}
}
if (hd->svsrc != NULL) {
if (hd->fifosrc != NULL) {
sv_fifo_free(hd->svsrc, hd->fifosrc);
hd->fifosrc = NULL;
}
sv_close(hd->svsrc);
hd->svsrc = NULL;
}
if(hd->nobuffer_org) {
free(hd->nobuffer_org);
}
if(hd->blackbuffer_org) {
free(hd->blackbuffer_org);
}
for(i = 0; i < MAX_ID; i++) {
if(hd->ancbuffer_org[i]) {
free(hd->ancbuffer_org[i]);
}
if(hd->livebuffer_org[i]) {
free(hd->livebuffer_org[i]);
}
if(hd->banc) {
//If there are valid packets delete them
if( hd->anclist[i].next ) {
//Delete all elements in list
delete_element( i, hd->anclist[i].next );
}
}
}
dvs_mutex_free(&hd->common.lock);
dvs_cond_free(&hd->common.ready);
printf("exiting dma loop through\n");
return 0;
}
开发者ID:elliotwoods,项目名称:SDICapture-Test,代码行数:57,代码来源:dmaloop.c
示例9: delete_element
void delete_element( int id, anc_element_t * anc_element )
{
if( anc_element ) {
if( anc_element->next ) {
delete_element( id, anc_element->next );
}
free( anc_element );
}
}
开发者ID:elliotwoods,项目名称:SDICapture-Test,代码行数:9,代码来源:dmaloop.c
示例10: GdipDeleteRegion
/*****************************************************************************
* GdipDeleteRegion [[email protected]]
*/
GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
{
TRACE("%p\n", region);
if (!region)
return InvalidParameter;
delete_element(®ion->node);
heap_free(region);
return Ok;
}
开发者ID:AndreRH,项目名称:wine,代码行数:15,代码来源:region.c
示例11: delete_meter_entry
OFDPE
delete_meter_entry( const uint32_t meter_id ) {
assert( table != NULL );
if ( meter_id == 0 && meter_id <= OFPM_MAX && meter_id != OFPM_CONTROLLER && meter_id != OFPM_ALL ) {
return ERROR_OFDPE_METER_MOD_FAILED_INVALID_METER;
}
OFDPE ret = OFDPE_SUCCESS;
if ( !lock_pipeline() ) {
return ERROR_LOCK;
}
if ( meter_id == OFPM_ALL ) {
delete_flow_entries_by_meter_id( meter_id );
for ( list_element *e = table->entries; e != NULL; ) {
list_element *next = e->next;
meter_entry *entry = e->data;
if ( entry->meter_id > 0 && entry->meter_id <= OFPM_MAX ) { // virtual meters won't be deleted by OFPM_ALL
delete_element( &table->entries, entry );
free_meter_entry( entry );
}
e = next;
}
} else {
meter_entry *old_entry = lookup_meter_entry( meter_id );
if ( NULL == old_entry ) {
ret = ERROR_OFDPE_METER_MOD_FAILED_UNKNOWN_METER;
} else {
if ( old_entry->ref_count > 0 ) {
delete_flow_entries_by_meter_id( meter_id );
}
delete_element( &table->entries, old_entry );
free_meter_entry( old_entry );
}
}
if ( !unlock_pipeline() ) {
return ERROR_UNLOCK;
}
return ret;
}
开发者ID:cs470Group,项目名称:sdn-controller,代码行数:40,代码来源:meter_table.c
示例12: delete_outbound_switch
static void
delete_outbound_switch( list_element **switches, switch_info *delete_switch ) {
list_element *ports = delete_switch->ports;
// delete ports
for ( list_element *p = ports; p != NULL; p = p->next ) {
xfree( p->data );
}
delete_list( ports );
// delete switch
delete_element( switches, delete_switch );
xfree( delete_switch );
}
开发者ID:n-tada,项目名称:trema,代码行数:14,代码来源:port.c
示例13: GdipSetInfinite
GpStatus WINGDIPAPI GdipSetInfinite(GpRegion *region)
{
GpStatus stat;
TRACE("%p\n", region);
if (!region)
return InvalidParameter;
delete_element(®ion->node);
stat = init_region(region, RegionDataInfiniteRect);
return stat;
}
开发者ID:AndreRH,项目名称:wine,代码行数:14,代码来源:region.c
示例14: remove_duplicate
int remove_duplicate(SLink **head)
{
//to keep track of next next link for duplicate cases
SLink *nextNext, *result;
//if empty link
if (NULL == (*head))
{
return EMPTYLIST;
}
//sort the given list
insert_sort(head);
/* take a local reference of head */
SLink *temp;
temp = *head;
//if single node
if((*head) -> link == NULL)
{
return SUCCESS;
}
{
/* if list has multiple nodes then, iterate till tail node */
while (temp -> link)
{
if (temp -> data != (temp -> link) -> data)
{
/* if no element is found at all then return */
if (((temp->link)-> link ) == NULL)
{
return SUCCESS;
}
temp = temp -> link;
}
else
{
nextNext = temp -> link;
delete_element(head, temp -> data);
temp = nextNext;
}
}
return SUCCESS;
}
return FAILURE;
}
开发者ID:nanditha16,项目名称:Emertxe,代码行数:49,代码来源:remove_duplicate.c
示例15: delete_flow_entry_from_table
static void
delete_flow_entry_from_table( flow_table *table, flow_entry *entry, uint8_t reason, bool notify ) {
assert( table != NULL );
assert( entry != NULL );
bool ret = delete_element( &table->entries, entry );
if ( ret ) {
decrement_active_count( table->features.table_id );
if ( notify ) {
flow_deleted( entry, reason );
}
decrement_reference_counters_in_groups( entry->instructions );
free_flow_entry( entry );
}
}
开发者ID:kazuyas,项目名称:trema-edge,代码行数:15,代码来源:flow_table.c
示例16: delete_mineral
int delete_mineral(t_cell *cell, t_mineral mineral)
{
t_link *tmp;
t_minerals *min;
tmp = cell->minerals->first;
while (tmp)
{
min = (t_minerals *)(tmp->data);
if (min->value == mineral)
return (delete_element(cell->minerals, tmp->data));
tmp = tmp->next;
}
return (-1);
}
开发者ID:sabs231,项目名称:zappy,代码行数:15,代码来源:minerals.c
示例17: main
int main(int argc, char ** argv)
{
int i,len;
dll_t *dll;
int array[] = {23,4,34,2,134};
len = sizeof(array)/sizeof(int);
dll = init_double_link();
for (i = 0; i < len; i++) {
insert_key_double_link(dll,array[i]);
}
printf("traverse\n");
traverse(dll);
printf("after DELETE 23traverse\n");
delete_element(dll,23);
traverse(dll);
printf("after DELETE 2 traverse\n");
delete_element(dll,2);
traverse(dll);
delete_element(dll,55);
traverse(dll);
return 0;
}
开发者ID:liahung,项目名称:IntroductionToAlgorithm-Third-Edition,代码行数:24,代码来源:main.c
示例18: clone_element
static inline GpStatus clone_element(const region_element* element,
region_element** element2)
{
GpStatus stat;
/* root node is allocated with GpRegion */
if(!*element2){
*element2 = GdipAlloc(sizeof(region_element));
if (!*element2)
return OutOfMemory;
}
(*element2)->type = element->type;
switch (element->type)
{
case RegionDataRect:
(*element2)->elementdata.rect = element->elementdata.rect;
break;
case RegionDataEmptyRect:
case RegionDataInfiniteRect:
break;
case RegionDataPath:
(*element2)->elementdata.pathdata.pathheader = element->elementdata.pathdata.pathheader;
stat = GdipClonePath(element->elementdata.pathdata.path,
&(*element2)->elementdata.pathdata.path);
if (stat != Ok) goto clone_out;
break;
default:
(*element2)->elementdata.combine.left = NULL;
(*element2)->elementdata.combine.right = NULL;
stat = clone_element(element->elementdata.combine.left,
&(*element2)->elementdata.combine.left);
if (stat != Ok) goto clone_out;
stat = clone_element(element->elementdata.combine.right,
&(*element2)->elementdata.combine.right);
if (stat != Ok) goto clone_out;
break;
}
return Ok;
clone_out:
delete_element(*element2);
*element2 = NULL;
return stat;
}
开发者ID:AmesianX,项目名称:RosWine,代码行数:48,代码来源:region.c
示例19: find
ERRORCODE RecordArray::remove(DB_RECORD_NUMBER record)
{
// Find the record.
int i = find(record);
// If we didn't find it, we can't delete it.
if (i == -1)
{
return ERRORCODE_BadParameter;
}
else
{
// Delete it!
return delete_element(i);
}
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:16,代码来源:RECARRAY.CPP
示例20: delete_wildcards_match_strict_entry
static void *
delete_wildcards_match_strict_entry( list_element **wildcards_table, struct ofp_match *match, uint16_t priority ) {
assert( match != NULL );
match_entry *entry = lookup_wildcards_match_strict_entry( *wildcards_table, match, priority );
if ( entry == NULL ) {
char match_string[ MATCH_STRING_LENGTH ];
match_to_string( match, match_string, sizeof( match_string ) );
warn( "wildcards match entry not found ( match = [%s], priority = %u )",
match_string, priority );
return NULL;
}
void *data = entry->data;
delete_element( wildcards_table, entry );
free_match_entry( entry );
return data;
}
开发者ID:Milstein,项目名称:trema,代码行数:17,代码来源:match_table.c
注:本文中的delete_element函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论