void CList::identityRemove(CListEntry* d) { for (CListElem* e = head(), *pe = NULL; e; pe = e, e = e->next()) { if (e->data() == d) { spliceOutNext(pe); break; } } }
void Table::identityRemove(CListEntry* k) { for (TableListElem* e = head(), *pe = NULL; e; pe = e, e = e->next()) { TableElem* d = e->data(); if (d->key == k) { spliceOutNext(pe); break; } } }
void Table::remove(CListEntry* k) { assert(k, "shouldn't be comparing zeros"); for (TableListElem* e = head(), *pe = NULL; e; pe = e, e = e->next()) { TableElem* d = e->data(); assert(d->key, "shouldn't have a zero key"); if (d->key->EQ(k)) { spliceOutNext(pe); break; } } }
CList* CList::identityIntersection(CList* l, bool makeCopy) { CListElem* e = head(), *pe = NULL; while (e) { CListEntry* x = e->data(); if (! l->identityIncludes(x)) { if (makeCopy) { return copy()->identityIntersection(l, false); } e = spliceOutNext(pe); } else { pe = e, e = e->next(); } } return this; }