NSArray for (... in ...)
NSArray for (... in ...)
- Subject: NSArray for (... in ...)
- From: Quincey Morris <email@hidden>
- Date: Fri, 23 May 2008 20:55:43 -0700
Incidentally, since the 'for (... in ...)' syntax got mentioned
earlier today, I'm prompted to ask whether anyone has found a
guarantee in the documentation (or in the header files, for that
matter) that, when the object being fast-enumerated is a NSArray, the
contents are returned in array index order. I haven't found any
written promises to this effect so far.
It may *seem* obvious that this should be the order of enumeration,
but I hesitate to rely on it if it's not documented.
And, given that it's nearly as easy to "enumerate" a NSArray in order
by iterating through its indexes, I did wonder whether the "fast"
version might be intended to be the fastest possible enumeration,
which might not be the index order if the internals of the object were
somewhat complex.
Anyone know a definitive answer to this?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden