(svn r17541) -Feature: Filtering in Add-NewGRF dialog.
This commit is contained in:
@@ -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.
|
||||
|
Reference in New Issue
Block a user