mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-09-01 19:09:09 +00:00
Codechange: Replaced SmallVector::ErasePreservingOrder(pos, count) with std::vector::erase()
This commit is contained in:
@@ -137,17 +137,6 @@ public:
|
||||
std::vector<T>::pop_back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove items from the vector while preserving the order of other items.
|
||||
* @param pos First item to remove.
|
||||
* @param count Number of consecutive items to remove.
|
||||
*/
|
||||
void ErasePreservingOrder(uint pos, uint count = 1)
|
||||
{
|
||||
auto const it = std::vector<T>::begin() + pos;
|
||||
std::vector<T>::erase(it, it + count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether a item is present in the vector, and appends it to the end if not.
|
||||
* The '!=' operator of T is used for comparison.
|
||||
|
@@ -494,7 +494,7 @@ struct RefitWindow : public Window {
|
||||
while (pos < l.size() && l[pos].subtype != refit_cyc) pos++;
|
||||
if (pos < l.size() && l[pos].string != subtype) {
|
||||
/* String mismatch, remove item keeping the order */
|
||||
l.ErasePreservingOrder(pos);
|
||||
l.erase(l.begin() + pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user