• 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
NSEnumerator doesn't support NSCopying - why?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSEnumerator doesn't support NSCopying - why?


  • Subject: NSEnumerator doesn't support NSCopying - why?
  • From: Wade Tregaskis <email@hidden>
  • Date: Tue, 10 Feb 2004 21:09:54 +1100

I'm trying to iterate through an array in the following way:

outerEnumerator = [objects objectEnumerator];

while (a = [outerEnumerator nextObject]) {
innerEnumerator = [outerEnumerator copy];

while (b = [innerEnumerator nextObject]) {
// do stuff here
}
}

Now, that'd be fantastic if NSEnumerator supported NSCopying. As is it raises an NSInvalidArgumentException (originating in copyWithZone:). I'm hesitant to revert to indexing into the array, since I would hope that using an enumerator would be faster.

Anyone know why an NSEnumerator (NSIdEnumerator, in this particular case) can't be copied, and some way to get around this, aside from the obvious i,j loop?

Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: are there any custom IB Palettes?
  • Next by Date: Re: Sending and receiving files to remote server through cocoa
  • Previous by thread: Create your own NSView Class
  • Next by thread: Re: NSEnumerator doesn't support NSCopying - why?
  • Index(es):
    • Date
    • Thread