From 535ead1241c7b50fd5f1760febe3423fbe4b6758 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 15 Jun 2001 22:18:09 +0000 Subject: [PATCH] allow one list to be initialized from, and also steal the contents from, another list --- src/libCom/cxxTemplates/tsSLList.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/libCom/cxxTemplates/tsSLList.h b/src/libCom/cxxTemplates/tsSLList.h index 01bf0d1bf..1849bcda5 100644 --- a/src/libCom/cxxTemplates/tsSLList.h +++ b/src/libCom/cxxTemplates/tsSLList.h @@ -75,6 +75,7 @@ template < class T > class tsSLList : public tsSLNode < T > { public: tsSLList (); // creates an empty list + tsSLList ( tsSLList & ); void insert ( T &item, tsSLNode < T > &itemBefore ); // insert after item before void add ( T &item ); // add to the beginning of the list T * get (); // remove from the beginning of the list @@ -85,8 +86,7 @@ public: tsSLIterConst firstIter () const; tsSLIter firstIter (); private: - tsSLList ( const tsSLList & ); // dissallowed - const tsSLList < T > & operator = ( const tsSLList < T > & ) const; + const tsSLList < T > & operator = ( const tsSLList < T > & ); }; // @@ -148,7 +148,8 @@ tsSLNode < T > ::tsSLNode () : pNext ( 0 ) {} // do _not_ change the node pointers // template < class T > -inline const tsSLNode < T > & tsSLNode < T >::operator = ( const tsSLNode < T > & ) const +inline const tsSLNode < T > & tsSLNode < T >::operator = + ( const tsSLNode < T > & ) const { return *this; } @@ -183,6 +184,16 @@ inline tsSLList < T > :: tsSLList () { } +// +// tsSLList::tsSLList( tsSLList & ) +// +template < class T > +inline tsSLList < T > :: tsSLList ( tsSLList &listIn ) +{ + this->pNext = listIn.pNext; + listIn.pNext = 0; +} + // // tsSLList::insert() // (itemBefore might be the list header object and therefore