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>©); protected: int count; Node<List_entry> * head; Node<List_entry> * set_position(int position) const; }; template<class List_entry> Node <List_entry> * List<List_entry>::set_position (int position) const { Node<List_entry> *q=head; for(int i=0;i<position;i++)q=q->next; return q; } template<class List_entry> Error_code List<List_entry>::insert(int position,const List_entry &x) { if(position<0 || position>count) return range_error; Node<List_entry> * new_node,*previous,*following; if(position>0){ previous=set_position(position-1); following=previous->next; } else following=head; new_node=new Node<List_entry>(x,following); if(new_node == NULL) return overflow; if(position==0) head=new_node; else previous->next=new_node; count++; return success; }