Codechange: Replaced SmallVector::Contains() with std::find() pattern

This commit is contained in:
Henry Wilson
2019-02-12 22:59:12 +00:00
committed by PeterN
parent b1f5119d3a
commit 5795f66d2e
8 changed files with 16 additions and 25 deletions

View File

@@ -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;
}