Re: Moving objects in NSMutableArray
Re: Moving objects in NSMutableArray
- Subject: Re: Moving objects in NSMutableArray
- From: Ondra Cada <email@hidden>
- Date: Sat, 4 May 2002 00:07:09 +0200
On Friday, May 3, 2002, at 11:54 , Thilo Ettelt wrote:
Hi! I see no possibility to move items in an NSMutableArray as to put
every object in an C Array and move the object(s) there. Is that right?
Probably not, though I regret to say I can't completely understand what
you mean.
When trying insertObject: atIndex: the previous objects will get lost...
Definitely not, nothing gets lost:
119 /tmp> cat q.m
#import <Foundation/Foundation.h>
int main() {
id a=[NSMutableArray arrayWithObjects:@"a",@"b",@"c",nil];;
NSLog(@"before %@",a);
[a insertObject:@"new" atIndex:1];
NSLog(@"after %@",a);
return 0;
}
120 /tmp> cc -Wall -framework Foundation q.m && ./a.out
2002-05-04 00:06:47.333 a.out[10294] *** _NSAutoreleaseNoPool(): Object
0x91ce0 of class NSCFArray autoreleased with no pool in place - just
leaking
2002-05-04 00:06:47.335 a.out[10294] before <CFArray 0x91ce0
[0x8016024c]>{type = mutable-small, count = 3, values = (
0 : a
1 : b
2 : c
)}
2002-05-04 00:06:47.337 a.out[10294] after <CFArray 0x91ce0
[0x8016024c]>{type = mutable-small, count = 4, values = (
0 : a
1 : new
2 : b
3 : c
)}
121 /tmp>
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
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.