Object pointer value as key into dictionary
Posted
by Ranking Stackingblocks
on Stack Overflow
See other posts from Stack Overflow
or by Ranking Stackingblocks
Published on 2010-04-25T12:19:59Z
Indexed on
2010/04/25
12:23 UTC
Read the original article
Hit count: 218
I want to use the object's reference value as a key into a dictionary, as opposed to a copy of value of the object. So, I essentially want to store an object associated with a particular instance of another object in a dictionary and retrieve that value later.
Is this possible? Is it completely against the idea of NSDictionary? I can tell that I am probably approaching this the wrong way because the dictionary wants me to implement NSCopying on the object itself, which doesn't really make sense in terms of what I'm doing. I can see that what I should really be doing is wrapping the pointer value, but that seems a little mad.
Advice would be appreciated.
© Stack Overflow or respective owner