Hi Greg,
hope the runtime is being docile. :-)
On May 4, 2009, at 23:24 , Greg Parker wrote:
That's right. In some discussions of object-oriented programming, a
distinction is made between "value objects" and "reference objects".
Two value objects can be "equal" if they share the same "valu
Wow, I'm learning a lot from this list. Thanks all for everything, now my
code is finally working as I had wanted. :)
Weydson
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Con
That's right. In some discussions of object-oriented programming, a
distinction is made between "value objects" and "reference objects".
Two value objects can be "equal" if they share the same "value", even
if they are separately allocated objects with different pointer
addresses in memory.
On May 4, 2009, at 11:52 PM, Weydson Lima wrote:
when I use
the removeObjectForKey, how can I make a reference to a specific
key? Let's
say I want to remove key that was initialized with [NSNumber
numberWithInt:1]. If I call removeObjectForKey:[NSNumber
numberWithInt:1],
that method won't
Hey Weydson -
NSDictionary equates keys by using -[NSObject isEqual:] and -[NSObject
hash], so a number with a different pointer address but the same value
as determined by isEqual: is fine.
If identity vs value does become an important distinction for you,
CFDictionary gives you control
Thanks all for the replies. I clearly understand now that I should use
NSNumber instead of NSInteger. However, another question came up: when I use
the removeObjectForKey, how can I make a reference to a specific key? Let's
say I want to remove key that was initialized with [NSNumber
numberWithInt:
Le 4 mai 09 à 22:58, Alexander Heinz a écrit :
On May 4, 2009, at 3:22 AM, Weydson Lima wrote:
I know that these methods are expecting pointers as parameters and
I am passing a scalar. So, what's the best way to approach that?
That's correct. You really shouldn't put any scalar types in an
Assume that:
NSMutableDictionary *result = [[NSMutableDictionary alloc]
initWithCapacity:10];
NSInteger ID;
And I add objects to the dictionary:
[result setObject:[NSArray arrayWithObjects: {... objects ...}
nil]
On May 4, 2009, at 2:22 AM, Weydson Lima wrote:
NSMutableDictionary *result = [[NSMutableDictionary alloc]
initWithCapacity:10];
NSInteger ID;
And I add objects to the dictionary:
[result setObject:[NSArray arrayWithObjects: {... objects ...}
On May 4, 2009, at 3:22 AM, Weydson Lima wrote:
I know that these methods are expecting pointers as parameters and I
am passing a scalar. So, what's the best way to approach that?
That's correct. You really shouldn't put any scalar types in an
NSDictionary (or any other container type in the
On May 4, 2009, at 1:22 AM, Weydson Lima wrote:
I am getting warnings when adding integers in the array and assigning
the integer ID as a key. The code does work though, but I am guessing
there is a better way to accomplish what I want. I know that these
methods are expecting pointers as parame
On May 4, 2009, at 2:22 AM, Weydson Lima wrote:
I am getting warnings when adding integers in the array and assigning
the integer ID as a key. The code does work though, but I am guessing
there is a better way to accomplish what I want. I know that these
methods are expecting pointers as paramet
Hi,
Assume that:
NSMutableDictionary *result = [[NSMutableDictionary alloc]
initWithCapacity:10];
NSInteger ID;
And I add objects to the dictionary:
[result setObject:[NSArray arrayWithObjects: {... objects ...}
13 matches
Mail list logo