• 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
CFMutableDictionary vs. NSMapTable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CFMutableDictionary vs. NSMapTable


  • Subject: CFMutableDictionary vs. NSMapTable
  • From: Bill Bumgarner <email@hidden>
  • Date: Mon, 9 Sep 2002 09:25:42 -0400

I need to create a set of maps between integer keys and either objects or integer values, depending on context (though any one given dictionary/map will only have values of a single type, obviously).

I have long used NSMapTable's API in this context, but was curious if CFDictionary's API is now preferable. Looking further at CFDictionary, it doesn't explicitly document a case where a non-CFTypeRef is used as the key or values. At the same time, the key and value callback functions appear to do what is needed to use integer key/values if you simply pass in NULL for the structure references.

However, given that the fact that the number of bits in an (int) is only coincidentally the same as the number of bits in (void *) -- (void *) being the type of all key and value parameters to the CFDictionary APIs -- it would appear that CFDictionary is very explicitly only designed to handle pointer types.

As such, I'm sticking with NSMapTable.

Correct line of thinking or did I miss something?

b.bum
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: CFMutableDictionary vs. NSMapTable
      • From: Mike Shields <email@hidden>
  • Prev by Date: Sample code with CGFunctionRef?
  • Next by Date: [newbie] Font attributes in NSTextView
  • Previous by thread: Sample code with CGFunctionRef?
  • Next by thread: Re: CFMutableDictionary vs. NSMapTable
  • Index(es):
    • Date
    • Thread