2008/12/16 Кутейников Дмитрий <[email protected]>: > 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; > } >
An object can be iterable with a foreach block with having method for removing items, so this can't be automatic. Also, many potentially iterable objects have no concept of removing items anyway. Whether there will be a performance issue depends on the type of collection. Something array backed won't cost anything extra, something linked list backed will. -- Phil Housley _______________________________________________ Vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
