Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3668 in orxonox.OLD for orxonox/trunk/src/lib/util


Ignore:
Timestamp:
Mar 30, 2005, 11:40:16 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: made list more performant and less vulnerable to segfaults. changed the benchmark function to only display list attributes for now. changed pnode to iterator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/util/list.h

    r3661 r3668  
    7575  this->currentEl = startElement;
    7676  this->firstEl = startElement;
    77   this->counter = -1;
     77  if( this->firstEl != NULL)
     78    this->counter = -1; 
     79  else
     80    this->counter = 0;
    7881}
    7982
     
    8992inline T* tIterator<T>::nextElement ()
    9093{
     94  /*
    9195  this->counter++;
    9296  if( this->counter == 0)
    9397    return this->firstEl->curr;
    94  
    95   if( this->currentEl->next == NULL || this->currentEl == NULL)
     98  */
     99
     100  if( this->currentEl == NULL)
    96101    return NULL;
    97102
     103  listElement<T>* tmp = this->currentEl;
    98104  this->currentEl = this->currentEl->next;
    99   return this->currentEl->curr;
     105  return tmp->curr;
    100106}
    101107
     
    104110template<class T> class tList
    105111{
    106  
    107112 public:
    108113  tList ();
     
    188193          else this->currentEl->next->prev = this->currentEl->prev;
    189194
    190           te = this->currentEl->next;  // for what am i doing this?
     195          //te = this->currentEl->next;  // for what am i doing this?
    191196          delete this->currentEl;
    192           this->currentEl = te;
     197          //this->currentEl = te;
     198          this->currentEl = NULL;
    193199          this->size--;
    194200          return;
Note: See TracChangeset for help on using the changeset viewer.