On Wed, Jan 28, 2015 at 7:39 PM, Cameron McCormack <c...@mcc.id.au> wrote:

> Xidorn Quan:
> > I asked a question in #developers that what is the best way to reversely
> > iterating nsTArray, and there are some suggestions:
>
> For cases where we don’t need to know the index of the array, can we
> support something like:
>
>   for (e : array.ReverseIterator()) { ... }
>
> or:
>
>   for (e : ReverseIterator(array)) { ... }
>
> (I notice that boost::adaptors::reversed is something like this.)
>
> There’s a danger that it’s not clear what happens if you modify the
> array while using the iterator, but it’s probably no worse than using
> the indexes that would come from ReverseIntegerRange.


Hmm. It reminds me that we might not need a ReverseIntegerRange at all. We
can have a Range, and a Reversed, then combine them to achieve
ReversedRange. We can make Reversed works with nsTArray as well :)

- Xidorn
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to