gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableDictionary requires NSCopying?


From: Richard Frith-Macdonald
Subject: Re: NSMutableDictionary requires NSCopying?
Date: Mon, 19 Mar 2007 10:43:36 +0000


On 19 Mar 2007, at 10:24, Michael Gardner wrote:

To use a custom key type with NSMutableDictionary, I defined -hash and
-isEqual: but not -copyWithZone:, since the NSDictionary docs say that
keys are retained rather than copied. But when I try to insert a key
of that type, I get an NSInvalidArgumentException saying that my class
does not recognize -copyWithZone:. If I add that method, the exception
goes away and everything works fine. I've tried this on both the
latest GNUstep release and on trunk. Are the docs just out-of-date?

Yes, the documentation is just wrong. Dictionary keys do need to be copied.

I've fixed the documentation (at least, all the errors I spotted) in svn trunk to say that keys are copied.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]