Revert "IdList::RemoveTagged switch to std::remove_if from iteration. NFC."

This reverts commit 0bb6a348e3.
This commit is contained in:
Ryan Pavlik 2019-08-20 18:10:35 -05:00 committed by whitequark
parent b284e80785
commit 13820bf27d

View File

@ -493,22 +493,24 @@ public:
} }
void RemoveTagged() { void RemoveTagged() {
auto newEnd = std::remove_if(this->begin(), this->end(), [](T &t) { int src, dest;
if(t.tag) { dest = 0;
t.Clear(); for(src = 0; src < n; src++) {
return true; if(elem[src].tag) {
} // this item should be deleted
return false; elem[src].Clear();
}); } else {
if(newEnd != this->end()) { if(src != dest) {
while (newEnd != this->end()) { elem[dest] = elem[src];
newEnd->~T(); }
++newEnd; dest++;
} }
} }
n = newEnd - begin(); for(int i = dest; i < n; i++)
elem[i].~T();
n = dest;
// and elemsAllocated is untouched, because we didn't resize
} }
void RemoveById(H h) { void RemoveById(H h) {
ClearTags(); ClearTags();
FindById(h)->tag = 1; FindById(h)->tag = 1;