1

来源:互联网 发布:wt网络语言什么意思啊 编辑:程序博客网 时间:2024/05/18 01:09

template<class node_entry>

struct node

{ node_entry entry;

  node<node_entry>*next;

  node(); 

  node(node_entry,node<node_entry>*link=NULL);

};

template<class List_entry>

  class List

{

  public:

  ~List();

 List(const List<List_entry>&copy);

 void operator=(const  List<List_entry>&copy);

protected:

int count;

node<List_entry>*head;

node<List_entry>*set_position(int position) const;

};

template<class List_entry>

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

if(position<1 || position>count)

return range error;

node<List_entry>*new_node,*previous,*following,*present;

if(new_node==NULL)

return overflow;

else

{new_node=present-->link;

present-->link=new_node-->link;

previous-->link=position-->link;

free( present);

return 0;

}