summaryrefslogtreecommitdiff
path: root/src/core/smallvec_type.hpp
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2019-02-12 22:59:12 +0000
committerPeterN <peter@fuzzle.org>2019-03-26 20:15:57 +0000
commit5795f66d2eebccbc8e04b80ebaf163f636479f9e (patch)
tree53bedfa6e40953f7aaeba3f7c2648e0839aef354 /src/core/smallvec_type.hpp
parentb1f5119d3af2fb47a2f1c752d61a742f41076451 (diff)
downloadopenttd-5795f66d2eebccbc8e04b80ebaf163f636479f9e.tar.xz
Codechange: Replaced SmallVector::Contains() with std::find() pattern
Diffstat (limited to 'src/core/smallvec_type.hpp')
-rw-r--r--src/core/smallvec_type.hpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/core/smallvec_type.hpp b/src/core/smallvec_type.hpp
index 5225d13da..9df015ad8 100644
--- a/src/core/smallvec_type.hpp
+++ b/src/core/smallvec_type.hpp
@@ -115,17 +115,6 @@ public:
}
/**
- * 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
* @note it has to be pointer to item in this map. It is overwritten by the last item.
@@ -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;
}