• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSMapTable with pointer keys ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMapTable with pointer keys ?


  • Subject: Re: NSMapTable with pointer keys ?
  • From: Benjamin Stiglitz <email@hidden>
  • Date: Thu, 27 Mar 2008 09:51:18 -0700

[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@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSMapTable with pointer keys ?
      • From: Guillaume Laurent <email@hidden>
References: 
 >NSMapTable with pointer keys ? (From: Guillaume Laurent <email@hidden>)

  • Prev by Date: NSScroller question
  • Next by Date: Re: NSMapTable with pointer keys ?
  • Previous by thread: NSMapTable with pointer keys ?
  • Next by thread: Re: NSMapTable with pointer keys ?
  • Index(es):
    • Date
    • Thread