forked from mirror/OpenTTD
Codechange: Replaced SmallVector::Contains() with std::find() pattern
This commit is contained in:
@@ -114,17 +114,6 @@ public:
|
||||
return it == std::vector<T>::end() ? -1 : it - std::vector<T>::begin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether a item is present in the vector.
|
||||
* The '!=' operator of T is used for comparison.
|
||||
* @param item Item to test for
|
||||
* @return true iff the item is present
|
||||
*/
|
||||
inline bool Contains(const T &item) const
|
||||
{
|
||||
return std::find(std::vector<T>::begin(), std::vector<T>::end(), item) != std::vector<T>::end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes given item from this vector
|
||||
* @param item item to remove
|
||||
@@ -145,7 +134,7 @@ public:
|
||||
*/
|
||||
inline bool Include(const T &item)
|
||||
{
|
||||
bool is_member = this->Contains(item);
|
||||
bool is_member = std::find(std::vector<T>::begin(), std::vector<T>::end(), item) != std::vector<T>::end();
|
||||
if (!is_member) *this->Append() = item;
|
||||
return is_member;
|
||||
}
|
||||
|
Reference in New Issue
Block a user