PDA

View Full Version : map-type data structure?




xytor
Apr 24, 2011, 11:21 AM
Does NSFoundation have a data structure like the std::map? NSMutableDictionary is close, but doesn't seem to have any way to check if a certain key is already inside.



PhoneyDeveloper
Apr 24, 2011, 12:08 PM
NSDictionary is it. objectForKey: tells you if there's an object stored with the specified key.

xytor
Apr 24, 2011, 02:29 PM
NSDictionary is it. objectForKey: tells you if there's an object stored with the specified key.

That's excellent, but how come the documentation makes no mention of this function?
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/Reference/Reference.html

Is there any documentation that lists ALL the functions?

Thanks.

robbieduncan
Apr 24, 2011, 02:36 PM
That's excellent, but how come the documentation makes no mention of this function?
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/Reference/Reference.html

Is there any documentation that lists ALL the functions?

Thanks.

Because Apple do not duplicate the documentation from superclasses in subclasses. The objectForKey: method (not function) is defined in NSDictionary which is NSMutableDictionaries superclass. So any NSDictionary method can be called on a NSMutableDictionary.

xytor
Apr 24, 2011, 02:37 PM
Because Apple do not duplicate the documentation from superclasses in subclasses. The objectForKey: method (not function) is defined in NSDictionary which is NSMutableDictionaries superclass. So any NSDictionary method can be called on a NSMutableDictionary.

Ooh that's good. My bad. Thanks for the clarification! :)