Re: pointer question
Re: pointer question
- Subject: Re: pointer question
- From: "Dennis C. De Mars" <email@hidden>
- Date: Tue, 03 Jul 2001 07:39:56 -0700
on 7/3/01 5:43 AM, Candide Kemmler at email@hidden wrote:
>
I've heard of something like the STL or so, doing things like the
>
Collection Framework in Java, but for C++. With it you could sort all
>
kinds of objects, construct complex data structures over which you can
>
easily iterate, etc... Sounds great ! Is there something similar for
>
Objective-C ? I'd love there was, but I don't think such a thing
>
exists... Does it ?
The Foundation framework in Cocoa has container classes that are more or
less the equivalent of STL or the Java collection classes. In your case, you
would use NSArray which has methods for sorting. If you want to sort in
place, you'd have to use NSMutableArray.
In general, take a look at the following to see the capabilities for doing
the equivalents of STL vectors, maps, etc:
NSArray and NSMutableArray
NSDictionary and NSMutableDictionary
NSSet and NSMutableSet
These all provide iterators for doing iterations over the set, subclasses of
NSEnumerator.
- Dennis D.