• 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
Re: RE: Array of random, non-repeating numbers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RE: Array of random, non-repeating numbers


  • Subject: Re: RE: Array of random, non-repeating numbers
  • From: "Michael Ash" <email@hidden>
  • Date: Thu, 13 Jul 2006 21:27:38 -0400

On 7/13/06, Jeff Laing <email@hidden> wrote:
> From: Nir Soffer [mailto:email@hidden]
> - (void)swapObjectAtIndex:(unsiged)a withObjectAtIndex:(unsiged)b {
>       id temp = [self objectAtIndex:a];
>       [self replaceObjectAtIndex:a withObject:[self objectAtIndex:b]];
>       [self replaceObjectAtIndex:b withObject:temp];
> }

I'm not sure, and I'd like a memory purist to step in and correct me if I'm
wrong, but I think this will have problems if the element in the array has a
retain count of 1.
[snip]

You avoid this problem altogether if you don't reimplement available
functionality and just use the built-in
-exchangeObjectAtIndex:withObjectAtIndex: method.

Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >RE: Array of random, non-repeating numbers (From: Jeff Laing <email@hidden>)

  • Prev by Date: RE: Array of random, non-repeating numbers
  • Next by Date: Re: DVDPlayback
  • Previous by thread: RE: Array of random, non-repeating numbers
  • Next by thread: Re: Weird tabbing results
  • Index(es):
    • Date
    • Thread