• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSArray for (... in ...)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSArray for (... in ...)
      • From: "Adam R. Maxwell" <email@hidden>
  • Prev by Date: Re: File's Owner
  • Next by Date: Re: Pasteboard question
  • Previous by thread: Re: How to capture data from NSImageView and display in NSView
  • Next by thread: Re: NSArray for (... in ...)
  • Index(es):
    • Date
    • Thread