Re: Gee Functional iterators



On 13/07/10 19:18, Martin DeMello wrote:
> One other thing - what about indexed iterators? Perhaps a method
> 
> Iterator<Pair<int, G>> indexed(Iterator <G>) that converts, say, map
> into map-with-index. (Even better if vala gets support for multivalued
> iterators, though that seems like quite a huge change :))

There is already language support for tupples in Dova profile and there
is great chance it comes one day to the GLib profile. So an iterator
could return a Tupple, and you could do:

foreach (var (i, e) in iterator.indexed()) {
	// do whatever with i and e
}

Regards, Didier.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]