Re: How can I get an instance specific identifier?
Re: How can I get an instance specific identifier?
- Subject: Re: How can I get an instance specific identifier?
- From: "Adam R. Maxwell" <email@hidden>
- Date: Fri, 24 Nov 2006 15:00:56 -0800
On Nov 24, 2006, at 13:31, Alan Smith wrote:
I want to use the memory location (eg 0x3a1c30) as the identifier for
the object. This would be for storing info in a dictionary, the memory
location would be used as the key. I just have no idea how to get the
memory location.
It doesn't have to be the memory location but it has to be specific to
the object and cannot be possible to have two with the same ID.
If you're using it as a key in a dictionary, you could also use the
object itself if you implement copyWithZone: to return [self retain]
and use NSObject's -hash and -isEqual: implementation. You can also
use a CFMutableDictionary with pointer-equality callbacks, as long as
you avoid toll-free bridging to add objects.
-- Adam
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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