On 12/12/2010 08:43 PM, Andrej M. wrote:
> I can't seem to find an easy remove method in std.algorithm that takes an
> object and a range (an array in this case) and removes any matches from the
> range. I'm using this snippet for now:
>
> private DrawingElement[] elements;
>
> public override void Remove(DrawingElement d)
> {
> foreach (i, child; elements)
> {
> if (child == d)
> {
> elements = remove(elements, i);
> break;
> }
> }
> }
Just want to mention that this code does not remove "any matches", but
only the first one! So if you want all removed, you have to improve it a
bit.
Matthias