On Jul 29, 2008, at 8:58 AM, Nathan Vander Wilt wrote:
Right, -[NSDictionary setObject:forKey:] on a CFDictionary created
with a custom retain callback will invoke copyWithZone: before
calling your retain callback. Apple claims this is not a bug.
Getting/removing values with objectForKey:/
What about using CFDictionary ? You can create a dicitonary with a
callback that support address (NULL for example).
I'll echo this; it's a really handy technique that I use frequently
(you can even use integers as keys!).
WARNING: Just in case, there is a major warning here. You should
a
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?
NSObject *myObject = [[NSObject alloc] init];
[dictionary setValue:myObject forKey:[NSString
stringWithFormat:@"%x", &myObject]];
Just remove the "&" before myO
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.
Agreed - I can't help
On Jul 28, 2008, at 3:23 PM, Jean-Daniel Dupas wrote:
Le 29 juil. 08 à 00:09, Charles Steinman a écrit :
--- On Mon, 7/28/08, Carter R. Harrison <[EMAIL PROTECTED]>
wrote:
Actually now that I'm looking at this more closely,
NSDictionary is
expecting an NSString for the key when inserting
Le 29 juil. 08 à 00:09, Charles Steinman a écrit :
--- On Mon, 7/28/08, Carter R. Harrison <[EMAIL PROTECTED]>
wrote:
Actually now that I'm looking at this more closely,
NSDictionary is
expecting an NSString for the key when inserting a value.
Your
example uses an NSValue for the key - the
--- On Mon, 7/28/08, Carter R. Harrison <[EMAIL PROTECTED]> wrote:
> Actually now that I'm looking at this more closely,
> NSDictionary is
> expecting an NSString for the key when inserting a value.
> Your
> example uses an NSValue for the key - the compiler is
> throwing a
> warning for th
On Mon, Jul 28, 2008 at 3:29 PM, Jonathan Hess <[EMAIL PROTECTED]> wrote:
>
> 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 try
On Mon, Jul 28, 2008 at 3:52 PM, Carter R. Harrison
<[EMAIL PROTECTED]> wrote:
>
> Actually now that I'm looking at this more closely, NSDictionary is
> expecting an NSString for the key when inserting a value. Your example uses
> an NSValue for the key - the compiler is throwing a warning for thi
On Jul 28, 2008, at 3:24 PM, David Wilson wrote:
On Mon, Jul 28, 2008 at 2:13 PM, Carter R. Harrison
<[EMAIL PROTECTED]> wrote:
Hey Everybody,
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?
Right now I'm doing
On Jul 28, 2008, at 3:41 PM, Andy Lee wrote:
On Jul 28, 2008, at 3:29 PM, Jonathan Hess wrote:
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:)
Ah, g
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
y
On Jul 28, 2008, at 3:40 PM, Charles Srstka wrote:
On Jul 28, 2008, at 2:29 PM, Jonathan Hess wrote:
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:)
On Jul 28, 2008, at 12:32 PM, Carter R. Harrison wrote:
The issue was with the format string.. Instead of a %x, I needed a
%qx. The %qx displays a 64 bit address whereas the %x displays a 32
bit address. When you give %x, only the least significant 32 bits
are printed and those happen to
On Jul 28, 2008, at 12:34, Andy Lee wrote:
On Jul 28, 2008, at 2:31 PM, Dave Carrigan wrote:
On Jul 28, 2008, at 11:13 AM, Carter R. Harrison 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
On Jul 28, 2008, at 3:29 PM, Jonathan Hess wrote:
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
On Jul 28, 2008, at 2:29 PM, Jonathan Hess wrote:
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 im
On Jul 28, 2008, at 2:31 PM, Dave Carrigan wrote:
On Jul 28, 2008, at 11:13 AM, Carter R. Harrison 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
On Jul 28, 2008, at 3:24 PM, David Wilson wrote:
On Mon, Jul 28, 2008 at 2:13 PM, Carter R. Harrison
<[EMAIL PROTECTED]> wrote:
Hey Everybody,
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?
Right now I'm doing
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
On Jul 28, 2008, at 11:13, Carter R. Harrison 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?
The usual way would be to use the result of +[NSValue
valueWithNonretainedObject:] as a dictionary key.
__
On Mon, Jul 28, 2008 at 2:13 PM, Carter R. Harrison
<[EMAIL PROTECTED]> wrote:
> Hey Everybody,
>
> 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?
>
> Right now I'm doing this:
>
> int i;
> for (i = 0 ; i < 10 ; i+
>> 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.
Agreed - I can't hel
On Jul 28, 2008, at 11:13 AM, Carter R. Harrison 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,
Hey Everybody,
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?
Right now I'm doing this:
int i;
for (i = 0 ; i < 10 ; i++)
{
NSObject *myObject = [[NSObject alloc] init];
[dictionary setValue:myObject forKey:[N
25 matches
Mail list logo