list move习题

来源:互联网 发布:网速流量监控软件 编辑:程序博客网 时间:2024/06/09 20:54

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;

}