On Dec 28, 2009, at 18:41, Graham Cox wrote:

> I was wondering if fast enumeration operated on a copy internally. I'm 
> thinking 'no', since ...

The implementation of the fast enumeration protocol is different in every class 
that conforms to it, but typically it would be expected not to copy anything.

However, I *think* it would be functionally just fine for an implementer of the 
protocol to do exactly that: copy enough of the collection storage structure to 
be able to keep iterating after deletions were made from the actual collection. 
Detection of the mutation is completely in the hands of the implementer, so it 
could simply not report any change.

It would no longer be a "fast" enumeration, but it would be a "mutable" 
enumeration, with a nice concise syntax. Unfortunately, there'd be no way to 
have both possibilities in a single class.

But maybe I haven't thought through all the issues ...


_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to