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

This reverts commit 0bb6a348e3.
pull/466/head
Ryan Pavlik 2019-08-20 18:10:35 -05:00 committed by whitequark
parent b284e80785
commit 13820bf27d
1 changed files with 15 additions and 13 deletions

View File

@ -493,22 +493,24 @@ public:
}
void RemoveTagged() {
auto newEnd = std::remove_if(this->begin(), this->end(), [](T &t) {
if(t.tag) {
t.Clear();
return true;
int src, dest;
dest = 0;
for(src = 0; src < n; src++) {
if(elem[src].tag) {
// this item should be deleted
elem[src].Clear();
} else {
if(src != dest) {
elem[dest] = elem[src];
}
return false;
});
if(newEnd != this->end()) {
while (newEnd != this->end()) {
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) {
ClearTags();
FindById(h)->tag = 1;