On Jul 22, 2010, at 16:37, Graham Cox wrote:

> On 23/07/2010, at 9:28 AM, Jonathon Kuo wrote:
> 
>> If I use this to go backward through the array:
>> 
>> for (_id in [array reverseObjectEnumerator]) {  
>> }
>> 
>> ...is it still considered 'fast' enumeration?
> 
> 
> Yes, NSEnumerator conforms to the fast enumeration protocol.

... although we don't know know (AFAIK) whether the NSEnumerator implementation 
is really "fast". (It could implement the protocol, but still retrieve objects 
one at a time with 'nextObject' internally. That would have similar performance 
to using NSEnumerator the old way, I think.)

My guess is that the NSEnumerator class has a generic implementation that isn't 
any faster, but that specific enumerators (such as NSArray, NSSet, 
NSDictionary, etc) really use the underying collection's fast 
implementation._______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to