I have a need to associate objects with an arbitrary unsigned integer, which can be pretty much anything. I figured a dictionary with NSNumbers as keys would be perfect, where the NSNumber is created using +numberWithUnsignedInteger:
Trouble is, each time I create the number, it's a new object even if it contains a value NSNumber has seen before, so the lookup fails. So, I thought I'd just create suitable static NSNumbers, but I have the same problem in another place, since I then need to know which static NSNumbers I've allocated already to a given integer, which means looking them up. While I could just add them to an array and conduct a linear search - for the current situation efficiency isn't likely to be an issue - this solution wouldn't scale very well if it ever needed to. Is there an obvious alternative I'm overlooking? --Graham _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
