Re: A simple doubt about array

2008-06-11 Thread Matt Gough
On 11 Jun 2008, at 03:09, Jens Alfke wrote: That way you won't run into the issue that NSArray objects can't contain empty (nil) elements... Another thing that is often overlooked by Cocoa newbies is that you can add NSNull to NSArray objects (and other collection objects) e.g MyObj* a

Re: A simple doubt about array

2008-06-11 Thread Keith Duncan
NSArray objects can't contain empty (nil) elements... NSPointerArray objects can if you really want an Objective-C interface. And you might just want to implement this as a C array They will also handle object memory management like an NSArray, depending on how you initialise it. However

Re: A simple doubt about array

2008-06-10 Thread Jens Alfke
It would be a lot more efficient to implement a two-dimensional m-by-n array as a single NSArray with m*n elements. Then the object at (row,column) is the object at index row*width+column. That's basically how C implements multi-dimensional arrays. You can't make this accessor a simple cate

Re: A simple doubt about array

2008-06-10 Thread Adam Leonard
If you do want to make use of some of the nice features of NSArray that C arrays don't have, it is trivial to add a category to NSArray that makes object retrieval easier. See http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_4_section_1.html An example imp