Skip navigation.
 
mlRe: NSMapTable with pointer keys ?
FROM : Benjamin Stiglitz
DATE : Thu Mar 27 17:51:18 2008

> [NSMapTable 
> mapTableWithKeyOptions:NSMapTableObjectPointerPersonality 
> valueOptions:NSMapTableStrongMemory]
>
> (reading the doc for NSMap, I figured these are the right options)
>
> However, when trying to fetch an object with a void* key to check 
> for its presence (using the C api as recommended)
>
> NSMapGet(myMap, aKey);
>
> I get an instant crash and looking at the stack trace, it's because 
> aKey is being sent an ObjC message, to which it will hard time 
> replying since it's not an NSObject in the first place.


That’s because you’ve marked the keys as being object pointers; you’ve 
got your key and value pointer functions reversed.

(Also be sure you want the StrongMemory personality, and not 
OpaqueMemory.)

-Ben_______________________________________________

Cocoa-dev mailing list (<email_removed>)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>

This email sent to <email_removed>

Related mailsAuthorDate
mlNSMapTable with pointer keys ? Guillaume Laurent Mar 27, 16:24
mlRe: NSMapTable with pointer keys ? Benjamin Stiglitz Mar 27, 17:51
mlRe: NSMapTable with pointer keys ? Guillaume Laurent Mar 27, 18:14
mlRe: NSMapTable with pointer keys ? Guillaume Laurent Mar 27, 18:17
mlRe: NSMapTable with pointer keys ? Guillaume Laurent Mar 28, 00:20