Re: Reversely iterating nsTArray

2015-01-29 Thread Trevor Saunders
On Wed, Jan 28, 2015 at 10:59:48AM -0500, Ehsan Akhgari wrote: > On 2015-01-27 9:24 PM, Xidorn Quan wrote: > >I asked a question in #developers that what is the best way to reversely > >iterating nsTArray, and there are some suggestions: > > > > uint32_t count = arra

Re: Reversely iterating nsTArray

2015-01-28 Thread Xidorn Quan
On Thu, Jan 29, 2015 at 2:59 AM, Ehsan Akhgari wrote: > On 2015-01-27 9:24 PM, Xidorn Quan wrote: > >> I asked a question in #developers that what is the best way to reversely >> iterating nsTArray, and there are some suggestions: >> >> uint32_t count = array.Leng

Re: Reversely iterating nsTArray

2015-01-28 Thread Xidorn Quan
On Thu, Jan 29, 2015 at 2:59 AM, Ehsan Akhgari wrote: > On 2015-01-27 9:24 PM, Xidorn Quan wrote: > >> I asked a question in #developers that what is the best way to reversely >> iterating nsTArray, and there are some suggestions: >> >> uint32_t count = array.Leng

Re: Reversely iterating nsTArray

2015-01-28 Thread Ehsan Akhgari
On 2015-01-27 9:24 PM, Xidorn Quan wrote: I asked a question in #developers that what is the best way to reversely iterating nsTArray, and there are some suggestions: uint32_t count = array.Length(); for (uint32_t i = length - 1; i < length; i--) iterate from length() to 1 and index usin

Re: Reversely iterating nsTArray

2015-01-28 Thread Seth Fowler
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.R

Re: Reversely iterating nsTArray

2015-01-28 Thread Xidorn Quan
On Wed, Jan 28, 2015 at 7:39 PM, Cameron McCormack 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 ar

Re: Reversely iterating nsTArray

2015-01-28 Thread Cameron McCormack
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:

Re: Reversely iterating nsTArray

2015-01-28 Thread Seth Fowler
Fiddlesticks! I’d have immediate use for both of those things, that’s why I suggested them. Also, the first suggestion is probably actually less typing than not doing it that way. You’re basically writing ‘template ’ at the front, where you lose some characters, but then you make it up every ti

Re: Reversely iterating nsTArray

2015-01-27 Thread Kyle Huey
On Wed, Jan 28, 2015 at 1:18 PM, Seth Fowler wrote: > Sounds good! +1 from me. > > Bike shedding: > > - Make Range() and ReverseRange() templates, so you can use them with any > type that supports the appropriate operators. This also implies removing > ‘Integer’ from their names, I think. > > - I

Re: Reversely iterating nsTArray

2015-01-27 Thread Xidorn Quan
On Wed, Jan 28, 2015 at 3:18 PM, Seth Fowler wrote: > Sounds good! +1 from me. > > Bike shedding: > > - Make Range() and ReverseRange() templates, so you can use them with any > type that supports the appropriate operators. This also implies removing > ‘Integer’ from their names, I think. > I wa

Re: Reversely iterating nsTArray

2015-01-27 Thread Seth Fowler
beginning and the end points, and another constructor that further supports specifying a stride. - Seth > On Jan 27, 2015, at 6:24 PM, Xidorn Quan wrote: > > I asked a question in #developers that what is the best way to reversely > iterating nsTArray, and there are some

Reversely iterating nsTArray

2015-01-27 Thread Xidorn Quan
I asked a question in #developers that what is the best way to reversely iterating nsTArray, and there are some suggestions: uint32_t count = array.Length(); for (uint32_t i = length - 1; i < length; i--) iterate from length() to 1 and index using i - 1 for (uint32_t i = array.Length()