• 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: Storing values in dictionary with their address as the key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Storing values in dictionary with their address as the key


  • Subject: Re: Storing values in dictionary with their address as the key
  • From: Jonathan Hess <email@hidden>
  • Date: Mon, 28 Jul 2008 12:29:37 -0700


On Jul 28, 2008, at 11:44 AM, I. Savant wrote:

If I wanted to store an object in a dictionary and set its key as the
object's memory address - how would I go about doing this?

I'm racking my brains trying to think of a good reason to do this and am
drawing a blank. I can, however, think of myriad bad reasons.

A good reason would be that you care about identity equality and not value equality. You care that the key is the exact same instance, not that it is an equivalent instance. (== vs isEqual:) Another reason would be that the keys might not implement NSCopying, which NSDictionary requires.


Jon Hess



Agreed - I can't help but wonder about class clusters but I can't think of a direct reason why this would be a 'problem area'. It's just the first thing that popped into my head. :-)

--
I.S.
_______________________________________________

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

_______________________________________________

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


  • Follow-Ups:
    • Re: Storing values in dictionary with their address as the key
      • From: "Michael Ash" <email@hidden>
    • Re: Storing values in dictionary with their address as the key
      • From: Andy Lee <email@hidden>
    • Re: Storing values in dictionary with their address as the key
      • From: Charles Srstka <email@hidden>
References: 
 >Storing values in dictionary with their address as the key (From: "Carter R. Harrison" <email@hidden>)
 >Re: Storing values in dictionary with their address as the key (From: Dave Carrigan <email@hidden>)
 >Re: Storing values in dictionary with their address as the key (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: Event-Driven XML Parsing and Entity References
  • Next by Date: Re: Storing values in dictionary with their address as the key
  • Previous by thread: Re: Storing values in dictionary with their address as the key
  • Next by thread: Re: Storing values in dictionary with their address as the key
  • Index(es):
    • Date
    • Thread