src/oldpool.h
changeset 10235 531716190738
parent 9111 48ce04029fe4
child 10304 ca65c08875e2
equal deleted inserted replaced
10234:84fbb9da6898 10235:531716190738
   153 		T *t = Tpool->Get(i);
   153 		T *t = Tpool->Get(i);
   154 		delete t;
   154 		delete t;
   155 	}
   155 	}
   156 }
   156 }
   157 
   157 
       
   158 /**
       
   159  * Template providing a predicate to allow STL containers of
       
   160  * pointers to pool items to be sorted by index.
       
   161  */
       
   162 template <typename T>
       
   163 struct PoolItemIndexLess {
       
   164 	/**
       
   165 	 * The actual comparator.
       
   166 	 * @param lhs the left hand side of the comparison.
       
   167 	 * @param rhs the right hand side of the comparison.
       
   168 	 * @return true if lhs' index is less than rhs' index.
       
   169 	 */
       
   170 	bool operator()(const T *lhs, const T *rhs) const
       
   171 	{
       
   172 		return lhs->index < rhs->index;
       
   173 	}
       
   174 };
   158 
   175 
   159 /**
   176 /**
   160  * Generalization for all pool items that are saved in the savegame.
   177  * Generalization for all pool items that are saved in the savegame.
   161  * It specifies all the mechanics to access the pool easily.
   178  * It specifies all the mechanics to access the pool easily.
   162  */
   179  */