Le 15 mars 09 à 19:33, Oleg Krupnov a écrit :
I need to use a dictionary inside a long, time-consuming operation. The keys of the dictionary are integers, the values are NSObjects. I could use NSDictionary, but I don't like the overhead of creating NSNumbers for the keys and then comparing them, where I could use integers directly more efficiently, both by time and memory. The question is: is there this kind of fast int-keyed dictionary in Cocoa or elsewhere? Thanks!
You can either use an NSMapTable with NSIntegerMapKeyCallBacks or a CFDictionaryRef with NULL key callbacks.
In both case, you should use the C API and not use objc call, even if NSMapTable is a class in 10.5 and CFDictionary is tool free bridged. The bridge works only with CFDictionary initialized with Copy Key , CFType Value call backs.
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com