I really love map in C++, it's fast and easy to program.
Is there anything similar in Cocoa?
I know I can mix C++ and obj-c together, but I'd rather use a more obj-c way to program :)
Thanks!!
I really love map in C++, it's fast and easy to program.
Is there anything similar in Cocoa?
I know I can mix C++ and obj-c together, but I'd rather use a more obj-c way to program :)
Thanks!!
Try NSDictionary / NSMutableDictionary.
As an aside, you should use a map/dictionary when it's the best data structure choice, not just because it's easy and fast (although programmer time is expensive, proper structure choice will help create a better overall design). Maps make sense when you need to quickly look up values, and you don't care if they are stored in a sorted order.
You might also want to use NSMapTable. It's main benefit is that it won't copy the key the way NSDictionary does.