Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 15, 2009, 1:26:23 AM (15 years ago)
Author:
rgrieder
Message:
  • Using std::vector instead of std::list in register/unregister Iterator/ObjectListIterator. That is approximately 6 times faster because the list has very few elements.
  • Inlined getIdentifier() for sure by exporting the heavy part to another function.
  • Also eliminated the need of isFirstCall() because the "static initialisation chaos" only applies to variables that cannot be evaluated at compile time.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/core/ObjectListIterator.h

    r2662 r2784  
    6565            {
    6666                this->element_ = 0;
    67                 this->iterator_ = ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
     67                ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
    6868            }
    6969
     
    7575            {
    7676                this->element_ = element;
    77                 this->iterator_ = ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
     77                ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
    7878            }
    7979
     
    8585            {
    8686                this->element_ = other.element_;
    87                 this->iterator_ = ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
     87                ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
    8888            }
    8989
     
    9393            inline ~ObjectListIterator()
    9494            {
    95                 ClassIdentifier<T>::getIdentifier()->getObjects()->unregisterObjectListIterator(this->iterator_);
     95                ClassIdentifier<T>::getIdentifier()->getObjects()->unregisterObjectListIterator(this);
    9696            }
    9797
     
    227227        private:
    228228            ObjectListElement<T>* element_;        //!< The element the Iterator points at
    229             std::list<void*>::iterator iterator_;  //!< The iterator in the notifying list of the ObjectList
    230229    };
    231230}
Note: See TracChangeset for help on using the changeset viewer.