remove函数的编写

template<class List_entry>

Error_code List<List_entry>::remove(int position,List_entry &x)

{

if(position<0||position>count)

return range_error;

Node<List_entry>*previous,*following,*current;

  else if(position>0){

previous=set_position(position-1);

current=set_position(position);

following=current->next;

previous->next=following;

}

    else  if(position==0)

{previous=set_position(0);

following=previous->next;

head=following;}

count--;

return success;}

posted @ 2013-09-26 11:32  寒冷的伪装  阅读(143)  评论(0)    收藏  举报