summaryrefslogtreecommitdiff
path: root/src/core/smallmap_type.hpp
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2018-09-25 22:01:05 +0100
committerPeterN <peter@fuzzle.org>2019-03-26 20:15:57 +0000
commitca2f33c6d025c0c45fb4bc472493290445312de5 (patch)
treecf39f3f0a815778049c037d80f0b86a11f1af665 /src/core/smallmap_type.hpp
parent097328c3d73520834b4ef801945c4f57f9eca0cd (diff)
downloadopenttd-ca2f33c6d025c0c45fb4bc472493290445312de5.tar.xz
Codechange: Replaced SmallVector::Erase() with std::vector::erase()
Diffstat (limited to 'src/core/smallmap_type.hpp')
-rw-r--r--src/core/smallmap_type.hpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/smallmap_type.hpp b/src/core/smallmap_type.hpp
index 44ace6b45..0bd9bd296 100644
--- a/src/core/smallmap_type.hpp
+++ b/src/core/smallmap_type.hpp
@@ -115,7 +115,8 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
inline void Erase(Pair *pair)
{
assert(pair >= this->Begin() && pair < this->End());
- SmallVector<Pair, S>::Erase(pair);
+ auto distance = pair - std::vector<Pair>::data();
+ std::vector<Pair>::erase(std::vector<Pair>::begin() + distance);
}
/**
@@ -126,11 +127,10 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
*/
inline bool Erase(const T &key)
{
- Pair *pair = this->Find(key);
- if (pair == this->End())
- return false;
+ auto pair = std::find(this->begin(), this->end(), key);
+ if (pair == this->end()) return false;
- SmallVector<Pair, S>::Erase(pair);
+ std::vector<Pair>::erase(pair);
return true;
}