Re: [Vala] foreach performance

2008-12-17 Thread Phil Housley
2008/12/17 Sam Liddicott : > I also mis-read Phil's response and also the original question from > Кутейников Дмитрий. > > And I've not been well lately I actually managed to write "with" instead of "without", so that one's probably not your fault. And I've been feeling ok recently -- P

Re: [Vala] foreach performance

2008-12-17 Thread Sam Liddicott
* Jürg Billeter wrote, On 17/12/08 13:51: > On Wed, 2008-12-17 at 13:39 +, Sam Liddicott wrote: > >> * Jürg Billeter wrote, On 17/12/08 13:04: >> >>> foreach is meant to be used for read-only iteration over a collection as >>> this is very common. It's really just a bit syntactic sugar

Re: [Vala] foreach performance

2008-12-17 Thread Jürg Billeter
On Wed, 2008-12-17 at 13:39 +, Sam Liddicott wrote: > * Jürg Billeter wrote, On 17/12/08 13:04: > > On Tue, 2008-12-16 at 17:58 +0300, Кутейников Дмитрий wrote: > > > > > Why there are no operator to remove current object in foreach block? > > > > > > > foreach is meant to be used for

Re: [Vala] foreach performance

2008-12-17 Thread Sam Liddicott
* Jürg Billeter wrote, On 17/12/08 13:04: > On Tue, 2008-12-16 at 17:58 +0300, Кутейников Дмитрий wrote: > >> Why there are no operator to remove current object in foreach block? >> > > foreach is meant to be used for read-only iteration over a collection as > this is very common. It's real

Re: [Vala] foreach performance

2008-12-17 Thread Jürg Billeter
On Tue, 2008-12-16 at 17:58 +0300, Кутейников Дмитрий wrote: > Why there are no operator to remove current object in foreach block? foreach is meant to be used for read-only iteration over a collection as this is very common. It's really just a bit syntactic sugar. If you need more features, use a

Re: [Vala] foreach performance

2008-12-17 Thread Phil Housley
2008/12/16 Кутейников Дмитрий : > 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) > { >

Re: [Vala] foreach performance

2008-12-16 Thread Martin Olsson
Sounds like you want a linked list, on those the .remove() is O(1) will not need to iterate over the collection. Martin Кутейников Дмитрий wrote: Hello! Why there are no operator to remove current object in foreach block? I have to write foreach(Components.Obj ob

[Vala] foreach performance

2008-12-16 Thread Кутейников Дмитрий
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_o