Changeset 5400 in orxonox.OLD for trunk/src/lib/util
- Timestamp:
- Oct 18, 2005, 9:32:34 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/list.h
r5285 r5400 38 38 void addAtBeginning(T* entity); //!< @todo This should be made with an ENUM 39 39 void remove(const T* entity); 40 void removeFromLast(const T* entity); 40 41 void removeLast(); 41 42 void flush(); … … 159 160 } 160 161 this->currentEl = this->currentEl->next; 162 } 163 } 164 165 /** 166 * remove an entity from the list 167 * @param entity: the entity to be removed 168 * 169 * this algorithm starts at the end of the List, working its way to the front 170 * for finding the right entity. 171 */ 172 template<class T> 173 inline void tList<T>::removeFromLast(const T* entity) 174 { 175 this->currentEl = this->last; 176 while( this->currentEl != NULL) 177 { 178 if( unlikely(this->currentEl->curr == entity)) 179 { 180 // erstes element? 181 if( unlikely(this->currentEl->prev == NULL)) this->first = this->currentEl->next; 182 else this->currentEl->prev->next = this->currentEl->next; 183 184 // letztes element? 185 if( unlikely(this->currentEl->next == NULL)) this->last = this->currentEl->prev; 186 else this->currentEl->next->prev = this->currentEl->prev; 187 188 delete this->currentEl; 189 this->size--; 190 return; 191 } 192 this->currentEl = this->currentEl->prev; 161 193 } 162 194 }
Note: See TracChangeset
for help on using the changeset viewer.