| 168 | } |
| 169 | |
| 170 | template<class I> forceinline bool |
| 171 | BndSet::overwrite(Space& home, I& ri) { |
| 172 | // Is new domain empty? |
| 173 | if (!ri()) { |
| 174 | //Was it empty? |
| 175 | if (fst()==nullptr) |
| 176 | return false; |
| 177 | fst()->dispose(home,lst()); |
| 178 | _size=0; fst(nullptr); lst(nullptr); |
| 179 | return true; |
| 180 | } |
| 181 | |
| 182 | RangeList* f = |
| 183 | new (home) RangeList(ri.min(),ri.max(),nullptr); |
| 184 | RangeList* l = f; |
| 185 | unsigned int s = ri.width(); |
| 186 | |
| 187 | ++ri; |
| 188 | |
| 189 | while (ri()) { |
| 190 | RangeList *n = new (home) RangeList(ri.min(),ri.max(),nullptr); |
| 191 | l->next(n); |
| 192 | l=n; |
| 193 | s += ri.width(); |
| 194 | ++ri; |
| 195 | } |
| 196 | |
| 197 | if (fst() != nullptr) |
| 198 | fst()->dispose(home,lst()); |
| 199 | fst(f); lst(l); |
| 200 | |
| 201 | // If the size did not change, nothing changed, as overwriting |
| 202 | // must not at the same time include and exclude elements. |
| 203 | if (size() == s) |
| 204 | return false; |
| 205 | |
| 206 | _size = s; |
| 207 | return true; |
| 208 | } |
| 209 | |
| 210 | forceinline void |
| 211 | BndSet::become(Space& home, const BndSet& that) { |