diff --git a/src/libCom/cxxTemplates/tsSLList.h b/src/libCom/cxxTemplates/tsSLList.h index cf21549b4..01bf0d1bf 100644 --- a/src/libCom/cxxTemplates/tsSLList.h +++ b/src/libCom/cxxTemplates/tsSLList.h @@ -104,10 +104,7 @@ public: tsSLIterConst operator ++ (int); const T * pointer () const; protected: - union { - const T *pConstEntry; - T *pEntry; - }; + const T * pEntry; tsSLIterConst ( const T *pInitialEntry ); friend class tsSLList < T >; }; @@ -116,7 +113,7 @@ protected: // tsSLIter // template < class T > -class tsSLIter : private tsSLIterConst { +class tsSLIter { public: bool valid () const; bool operator == (const tsSLIter &rhs) const; @@ -127,6 +124,7 @@ public: tsSLIter operator ++ (int); T * pointer () const; private: + T *pEntry; tsSLIter ( T *pInitialEntry ); friend class tsSLList < T >; }; @@ -274,61 +272,61 @@ inline tsSLIter tsSLList < T > :: firstIter () template < class T > inline tsSLIterConst::tsSLIterConst ( const T *pInitialEntry ) : - pConstEntry ( pInitialEntry ) + pEntry ( pInitialEntry ) { } template < class T > inline bool tsSLIterConst::valid () const { - return this->pConstEntry != 0; + return this->pEntry != 0; } template < class T > inline bool tsSLIterConst::operator == ( const tsSLIterConst &rhs ) const { - return this->pConstEntry == rhs.pConstEntry; + return this->pEntry == rhs.pConstEntry; } template < class T > inline bool tsSLIterConst::operator != (const tsSLIterConst &rhs) const { - return this->pConstEntry != rhs.pConstEntry; + return this->pEntry != rhs.pConstEntry; } template < class T > inline const T & tsSLIterConst::operator * () const { - return *this->pConstEntry; + return *this->pEntry; } template < class T > inline const T * tsSLIterConst::operator -> () const { - return this->pConstEntry; + return this->pEntry; } template < class T > inline tsSLIterConst & tsSLIterConst::operator ++ () // prefix ++ { - const tsSLNode < T > *pCurNode = this->pConstEntry; - this->pConstEntry = pCurNode->pNext; + const tsSLNode < T > *pCurNode = this->pEntry; + this->pEntry = pCurNode->pNext; return *this; } template < class T > -inline tsSLIterConst tsSLIterConst::operator ++ (int) // postfix ++ +inline tsSLIterConst tsSLIterConst::operator ++ ( int ) // postfix ++ { - tsSLIterConst tmp = *this; - const tsSLNode < T > *pCurNode = this->pConstEntry; - this->pConstEntry = pCurNode->pNext; + const tsSLIterConst tmp = *this; + const tsSLNode < T > *pCurNode = this->pEntry; + this->pEntry = pCurNode->pNext; return tmp; } template inline const T * tsSLIterConst < T > :: pointer () const { - return this->pConstEntry; + return this->pEntry; } ////////////////////////////////////////// @@ -339,7 +337,7 @@ inline const T * tsSLIterConst < T > :: pointer () const template < class T > inline tsSLIter::tsSLIter ( T *pInitialEntry ) : - tsSLIterConst ( pInitialEntry ) + pEntry ( pInitialEntry ) { } @@ -356,7 +354,7 @@ inline bool tsSLIter::operator == ( const tsSLIter &rhs ) const } template < class T > -inline bool tsSLIter::operator != (const tsSLIter &rhs) const +inline bool tsSLIter::operator != ( const tsSLIter &rhs ) const { return this->pEntry != rhs.pEntry; } @@ -376,15 +374,17 @@ inline T * tsSLIter::operator -> () const template < class T > inline tsSLIter & tsSLIter::operator ++ () // prefix ++ { - this->tsSLIterConst::operator ++ (); + const tsSLNode < T > *pCurNode = this->pEntry; + this->pEntry = pCurNode->pNext; return *this; } template < class T > -inline tsSLIter tsSLIter::operator ++ (int) // postfix ++ +inline tsSLIter tsSLIter::operator ++ ( int ) // postfix ++ { - tsSLIter tmp = *this; - this->tsSLIterConst::operator ++ (); + const tsSLIter tmp = *this; + const tsSLNode < T > *pCurNode = this->pEntry; + this->pEntry = pCurNode->pNext; return tmp; }