Matt Keyes wrote:

How do I have an int as a value in a NSMutableDictionary object?

By wrapping it in an NSNumber.

It seems like (b/c the type is "id" for the first param) that NSMutableDictionary wants a pointer. Well, how do I give it just a plain integer copy without having the compiler yell at me? I have been banging my head on my desk over this silly little thing.

You don't. The keys and values for NSDictionary are objects.

Also, how do I define a non-mutable dictionary of a particular size? There is no dictionaryWithCapacity function that I can find in the non-mutable version. All the examples I can find are not practical (i.e. hardcoding a dictionary at its creation with random values like @"One", @"Two", etc.).

Um. What are you really trying to accomplish? What would it mean to allocate a non-mutable dictionary with the capacity for 3 objects which could never be set? What would you do with such a thing? Notice that the capacity argument in the NSMutableDictionary factory doesn't define a hard limit; it defines an initial capacity to optimize initial memory allocation. So it doesn't really give you "a 3-slot dictionary" or something like that.

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to