Hello!
Why there are no operator to remove current object in foreach block?
I have to write

            foreach(Components.Obj obj in m_objects)
            {
                if(obj.item.x == x && obj.item.y == y)
                {
                    Events.disappear(obj);
                    m_objects.remove(obj);  //  :(
                    return obj;
                }

instead of

            foreach(Components.Obj obj in m_objects)
            {
                if(obj.item.x == x && obj.item.y == y)
                {
                    Events.disappear(obj);
                    remove obj;
                    return obj;
                }

*m_objects.remove(obj)* will start a new search from the beginning of list
so it is a great performance hit.
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to