From 6b2a91cd0c16d92e6b5a9284a8e08514ed48aff3 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 14 May 2002 20:20:01 +0000 Subject: [PATCH] added assignment operator to iterator --- src/libCom/cxxTemplates/tsDLList.h | 20 ++++++++++++++++-- src/libCom/cxxTemplates/tsSLList.h | 34 ++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/libCom/cxxTemplates/tsDLList.h b/src/libCom/cxxTemplates/tsDLList.h index ea1702f54..70a3f9a1f 100644 --- a/src/libCom/cxxTemplates/tsDLList.h +++ b/src/libCom/cxxTemplates/tsDLList.h @@ -113,8 +113,9 @@ class tsDLIterConstBD { public: tsDLIterConstBD (); bool valid () const; - bool operator == (const tsDLIterConstBD &rhs) const; - bool operator != (const tsDLIterConstBD &rhs) const; + bool operator == ( const tsDLIterConstBD & rhs ) const; + bool operator != ( const tsDLIterConstBD & rhs ) const; + tsDLIterConstBD & operator = ( const tsDLIterConstBD & ); const T & operator * () const; const T * operator -> () const; tsDLIterConstBD & operator ++ (); @@ -140,6 +141,7 @@ public: bool valid () const; bool operator == ( const tsDLIterBD & rhs ) const; bool operator != ( const tsDLIterBD & rhs ) const; + tsDLIterBD & operator = ( const tsDLIterBD & ); T & operator * () const; T * operator -> () const; tsDLIterBD & operator ++ (); @@ -500,6 +502,13 @@ inline bool tsDLIterConstBD::operator != (const tsDLIterConstBD &rhs) cons return this->pEntry != rhs.pEntry; } +template +inline tsDLIterConstBD & tsDLIterConstBD::operator = ( const tsDLIterConstBD & rhs ) +{ + this->pEntry = rhs.pEntry; + return *this; +} + template inline const T & tsDLIterConstBD::operator * () const { @@ -594,6 +603,13 @@ inline bool tsDLIterBD::operator != (const tsDLIterBD &rhs) const return this->pEntry != rhs.pEntry; } +template +inline tsDLIterBD & tsDLIterBD::operator = ( const tsDLIterBD & rhs ) +{ + this->pEntry = rhs.pEntry; + return *this; +} + template inline T & tsDLIterBD::operator * () const { diff --git a/src/libCom/cxxTemplates/tsSLList.h b/src/libCom/cxxTemplates/tsSLList.h index 193a3f407..c30f22a30 100644 --- a/src/libCom/cxxTemplates/tsSLList.h +++ b/src/libCom/cxxTemplates/tsSLList.h @@ -56,7 +56,7 @@ template class tsSLNode { public: tsSLNode (); - const tsSLNode < T > & operator = ( const tsSLNode < T > & ) const; + tsSLNode < T > & operator = ( const tsSLNode < T > & ) const; private: void removeNextItem (); // removes the item after this node T *pNext; @@ -97,9 +97,11 @@ private: template < class T > class tsSLIterConst { public: + tsSLIterConst (); bool valid () const; bool operator == (const tsSLIterConst &rhs) const; bool operator != (const tsSLIterConst &rhs) const; + tsSLIterConst & operator = (const tsSLIterConst &); const T & operator * () const; const T * operator -> () const; tsSLIterConst & operator ++ (); @@ -117,9 +119,11 @@ protected: template < class T > class tsSLIter { public: + tsSLIter (); bool valid () const; bool operator == (const tsSLIter &rhs) const; bool operator != (const tsSLIter &rhs) const; + tsSLIter & operator = (const tsSLIter &); T & operator * () const; T * operator -> () const; tsSLIter & operator ++ (); @@ -159,7 +163,7 @@ inline tsSLNode < T > :: tsSLNode ( const tsSLNode < T > & ) // do _not_ change the node pointers // template < class T > -inline const tsSLNode < T > & tsSLNode < T >::operator = +inline tsSLNode < T > & tsSLNode < T >::operator = ( const tsSLNode < T > & ) const { return *this; @@ -310,6 +314,12 @@ inline tsSLIterConst::tsSLIterConst ( const T *pInitialEntry ) : { } +template < class T > +inline tsSLIterConst::tsSLIterConst () : + pEntry ( 0 ) +{ +} + template < class T > inline bool tsSLIterConst::valid () const { @@ -328,6 +338,13 @@ inline bool tsSLIterConst::operator != (const tsSLIterConst &rhs) const return this->pEntry != rhs.pConstEntry; } +template < class T > +inline tsSLIterConst & tsSLIterConst::operator = ( const tsSLIterConst & rhs ) +{ + this->pEntry = rhs.pEntry; + return *this; +} + template < class T > inline const T & tsSLIterConst::operator * () const { @@ -375,6 +392,12 @@ inline tsSLIter::tsSLIter ( T *pInitialEntry ) : { } +template < class T > +inline tsSLIter::tsSLIter () : + pEntry ( 0 ) +{ +} + template < class T > inline bool tsSLIter::valid () const { @@ -393,6 +416,13 @@ inline bool tsSLIter::operator != ( const tsSLIter &rhs ) const return this->pEntry != rhs.pEntry; } +template < class T > +inline tsSLIter & tsSLIter::operator = ( const tsSLIter & rhs ) +{ + this->pEntry = rhs.pEntry; + return *this; +} + template < class T > inline T & tsSLIter::operator * () const {