www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - The best way to remove an element from DList while iterating over the

Hello!

I've been trying to implement something like that:

struct Element
{
     bool isPendingRelease;
}

DList!Element elements;

void FreePendingElements()
{
     foreach(ref elem; elements)
     {
         if (elem.isPendingRelease)
         {
             // remove it here from elements
         }
     }
}

What's the best way to implement the logic I want?

Thanks,
Ivan
Aug 31 2020