(svn r17541) -Feature: Filtering in Add-NewGRF dialog.

This commit is contained in:
frosch
2009-09-14 20:59:46 +00:00
parent 95dd198053
commit 2d9c54c9a8
3 changed files with 243 additions and 27 deletions

View File

@@ -115,6 +115,24 @@ public:
return pos;
}
/**
* Search for the first occurence of an item.
* The '!=' operator of T is used for comparison.
* @param item Item to search for
* @return The position of the item, or -1 when not present
*/
FORCEINLINE int FindIndex(const T &item)
{
int index = 0;
T *pos = this->Begin();
const T *end = this->End();
while (pos != end && *pos != item) {
pos++;
index++;
}
return pos == end ? -1 : index;
}
/**
* Tests whether a item is present in the vector.
* The '!=' operator of T is used for comparison.