list remove 方法

template < class List_entry >

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

{  

if (count == 0) return underflow ;

 if (position < 0 || position >=count) return range_error ;

 x = entry[position ];/X是被删除的元素  count −−;  

while (position < count)

 {

 entry[position] = entry[position+1];

 position++ ;

 }

return success;

}

posted @ 2013-09-26 18:32  XTQ  阅读(155)  评论(0)    收藏  举报