• 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: Andy Lee <email@hidden>
  • Date: Mon, 28 Jul 2008 16:16:14 -0400

On Jul 28, 2008, at 3:56 PM, Quincey Morris wrote:
On Jul 28, 2008, at 12:34, Andy Lee wrote:
Count me as another mystified person -- can you say what you're trying to do? I'm thinking maybe some kind of serialization or maybe object caching, but nothing makes sense. It sounds like what you want is a set of objects rather than a dictionary. If you have an address you can just dereference the address -- you don't need to look it up in a dictionary.

I've used this technique when replacing objects in an object graph with different objects. There may be multiple references an "old" object in the graph, and there may be multiple paths through the graph to each reference. When walking the graph, you just use [dict objectForKey: [NSValue valueWithNonretainedObject: oldObject]] to find out if you've already generated a replacement for the old object yet, and use [dict setObject: newObject forKey: [NSValue valueWithNonretainedObject: oldObject] to remember the replacement if you haven't.

Neat. Thanks, I'm much less mystified now.

--Andy


_______________________________________________

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: 
 >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: Andy Lee <email@hidden>)
 >Re: Storing values in dictionary with their address as the key (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Storing values in dictionary with their address as the key
  • Next by Date: Re: draw string with ellipsis
  • 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