| 225 | |
| 226 | template<class Iter> |
| 227 | forceinline void |
| 228 | RangeList::overwrite(Space& home, RangeList*& r, Iter& i) { |
| 229 | RangeList sentinel; sentinel.next(r); |
| 230 | RangeList* p = &sentinel; |
| 231 | RangeList* c = p->next(); |
| 232 | while ((c != nullptr) && i()) { |
| 233 | c->min(i.min()); c->max(i.max()); |
| 234 | p=c; c=c->next(); ++i; |
| 235 | } |
| 236 | if ((c == nullptr) && !i()) |
| 237 | return; |
| 238 | if (c == nullptr) { |
| 239 | assert(i()); |
| 240 | // New elements needed |
| 241 | do { |
| 242 | RangeList* n = new (home) RangeList(i.min(),i.max()); |
| 243 | p->next(n); p=n; ++i; |
| 244 | } while (i()); |
| 245 | } else { |
| 246 | // Dispose excess elements |
| 247 | while (c->next() != nullptr) |
| 248 | c=c->next(); |
| 249 | p->next()->dispose(home,c); |
| 250 | } |
| 251 | p->next(nullptr); |
| 252 | r = sentinel.next(); |
| 253 | } |
| 254 | |
| 255 | template<class I> |
| 256 | forceinline void |