Traverse a DList and insert / remove in place?
Armando
armando.sano at gmail.com
Mon Mar 27 15:05:16 UTC 2023
Wonderful, that works like a treat, thank you so much! For those
who wonder, inserting after works too:
```d
for (auto range = list[]; !range.empty;)
{
if (range.back.id == 8)
list.insertAfter(range, MyType(88));
range.popBack();
}
```
which will give
```
MyType(0)
MyType(1)
MyType(2)
MyType(4)
MyType(5)
MyType(66)
MyType(6)
MyType(7)
MyType(8)
MyType(88)
MyType(9)
```
More information about the Digitalmars-d-learn
mailing list