• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Dictionary with enum keys?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dictionary with enum keys?


  • Subject: Re: Dictionary with enum keys?
  • From: Debajit Adhikary <email@hidden>
  • Date: Mon, 27 Jul 2009 22:55:44 -0700

Thanks! The NSNumber approach is working fine :)

On Mon, Jul 27, 2009 at 1:35 PM, Ken Thomases <email@hidden> wrote:

> On Jul 27, 2009, at 3:52 AM, Jean-Daniel Dupas wrote:
>
>  Le 27 juil. 09 à 10:48, Debajit Adhikary a écrit :
>>
>>  I need to create a dictionary/hashmap where the
>>>
>>>  - Keys are enums
>>>  - Values are some subclass of NSObject
>>>
>>>
>>> NSDictionary won't work here (enums don't conform to NSCopying).
>>>
>>> I could perhaps use a CFDictionaryRef here, but I'd like to know if is
>>> there
>>> any other way to achieve this.
>>>
>>
>> NSMapTable using NSIntegerMapKeyCallBack. (The C API is recommanded when
>> working with something else than object)
>>
>> But CFDictionary is perfectly valid too.
>>
>
> You can also use NSDictionary with NSNumber keys.  You'll just have to cast
> your enum values to one of the integer types.
>
> Cheers,
> Ken
>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Dictionary with enum keys? (From: Debajit Adhikary <email@hidden>)
 >Re: Dictionary with enum keys? (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Dictionary with enum keys? (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: NSWindow reference remains null after window did load
  • Next by Date: Re: How to set the string and integer value of an NSButtonCell using NSOutilneView
  • Previous by thread: Re: Dictionary with enum keys?
  • Next by thread: Creating an installer for KEXT
  • Index(es):
    • Date
    • Thread