l); amp; AddLast (T val); amp; DeleteCurrent (); (void);
~ TList (void); ostream amp; operator lt; lt; (ostream amp; os, TList lt; T gt; amp; li)
{(li.isEmpty ())
{ lt; lt; Empty raquo ;; os;
}. Rewind (); (! li.isEnd ())
{ lt; lt; li.Get () lt; lt; raquo ;;. Next ();
}. Rewind (); os;
}
};
Файл TList.cpp. Реалізаційна частина
# include stdafx.h
# include TList.h lt; typename T gt; lt; T gt; amp; TList lt; T gt; :: CreateFirst (T val)
{ gt; first=new Elem lt; T gt ;; gt; first- gt; row=val; gt; first- gt; next=nullptr; gt; cur=this- gt; first; ( * this);
} lt; typename T gt; TList lt; T gt; :: operator=(const TList lt; T gt; amp;)
{TListException ( " = ": forbidden operator. raquo ;, 3);
} lt; typename T gt; lt; T gt; :: TList (const TList lt; T gt; amp;)
{TListException ( copying list: forbidden act. raquo ;, 3);
} lt; typename T gt; TList lt; T gt; :: isEmpty ()
{(this- gt; first == nullptr);
} lt; typename T gt; TList lt; T gt; :: isEnd ()
{(this- gt; cur == nullptr);
} lt; typename T gt; lt; T gt; amp; TList lt; T gt; :: Rewind ()
{ gt; cur=this- gt; first; (* this);
} lt; typename T gt; lt; T gt; amp; TList lt; T gt; :: Set (T val)
{(this- gt; isEnd ()) TListException ( Set (): Out of List raquo ;, 1); gt; cur- gt; row=val; (* this);
} lt; typename T gt; TList lt; T gt; :: Get ()
{(this- gt; isEnd ()) TListException ( Get (): Out of List raquo ;, 1); this- gt; cur- gt; row;
} lt; typename T gt; lt; T gt; amp; TList lt; T gt; :: Next ()
{(this- gt; isEnd ()) TListException ( Next (): Out of List raquo ;, 1); gt; cur=this- gt; cur- gt; next; (* this);
} lt; typename T gt; lt; T gt; amp; TList lt; T gt; :: InsertAfterCurrent (T val)
{(this- gt; isEmpty ()) this- gt; CreateFirst (val); lt; T gt; * temp=this- gt; cur- gt; next; gt; cur- gt; next=new Elem lt; T gt ;; gt; cur- gt; next- gt; next=temp; gt; cur- gt; next- gt; row=val; (* this);
} lt; typename T gt; lt; T gt; amp; TList lt; T gt; :: AddLast (T val)
{ gt; Rewind (); (this- gt; isEmpty ()) this- gt; CreateFirst (val); (this- gt; cur- gt; next!=nullptr)
{ gt; cur=this- gt; cur- gt; next;
} this- gt; InsertAfterCurrent (val);
} lt; typename T gt; lt; T gt; amp; TList lt; T gt; :: DeleteCurrent ()
{(this- gt; isEnd ()) TListException ( Delete (): Out of List raquo ;, 1); (this- gt; cur == this- gt; first)
{ gt; first=this- gt; cur- gt; next; this- gt; cur; gt; cur=this- gt; first; (* this);
} * ToDelete=this- gt; cur; * Nex=this- gt; cur- gt; next; gt; cur=this- gt; first; (this- gt; cur- gt; next!=ToDelete) gt; cur=this- gt; cur- gt; next; * Prev=this- gt; cur; gt; next=Nex; ToDelete; gt; cur=this- gt; first; (* this) ;
} lt; typename T gt; lt; T gt; :: TList (void)
{ gt; first=nullptr; gt; cur=this- gt; first;
} lt; typename T gt; lt; T gt; :: ~ TList (void)
{ gt; Rewind (); (this- gt; cur!=nullptr)
{ lt; T gt; * temp=this- gt; cur- gt; next; this- gt; cur; gt; cur=temp;
}
}
Файл TLineIterator.h. Інтерфейсна частина
# pragma once
# include TListBasicIterator.h lt; typename T gt; TLineIterator: public TListBasicIterator lt; T gt;
{: lt; T gt; * cur, * first; void nothing () {}: (); (const TList lt; T gt; amp; l); lt; T gt; amp; operator ++ (); amp; operator * (); lt; T gt; amp; operator ~ (); operator! ();
~ TLineIterator (void);
};
Файл TLineIterator. cpp. Реалізаційна частина
# include stdafx.h
# include TLineI...