src/oldpool.h
changeset 10235 531716190738
parent 9111 48ce04029fe4
child 10304 ca65c08875e2
--- a/src/oldpool.h	Mon Oct 13 03:40:48 2008 +0000
+++ b/src/oldpool.h	Tue Oct 14 12:07:14 2008 +0000
@@ -155,6 +155,23 @@
 	}
 }
 
+/**
+ * Template providing a predicate to allow STL containers of
+ * pointers to pool items to be sorted by index.
+ */
+template <typename T>
+struct PoolItemIndexLess {
+	/**
+	 * The actual comparator.
+	 * @param lhs the left hand side of the comparison.
+	 * @param rhs the right hand side of the comparison.
+	 * @return true if lhs' index is less than rhs' index.
+	 */
+	bool operator()(const T *lhs, const T *rhs) const
+	{
+		return lhs->index < rhs->index;
+	}
+};
 
 /**
  * Generalization for all pool items that are saved in the savegame.