Re: RE: Array of random, non-repeating numbers
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