• 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 C strings as keys
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMapTable with C strings as keys


  • Subject: Re: NSMapTable with C strings as keys
  • From: Graham Cox <email@hidden>
  • Date: Wed, 29 May 2013 08:46:55 +1000

On 28/05/2013, at 3:46 PM, Oleg Krupnov <email@hidden> wrote:

> I'd like to have a dictionary using C strings as keys (because I
> already have const char* strings and would like to spare on creating
> NSString wrappers)


For the sake of avoiding something you *assume* to be slow, or inefficient, you've taken the discussion in a direction that is vastly more complicated.

Why not just create NSString wrappers? By using the -initWithBytesNoCopy:length:encoding:freeWhenDone: method you can avoid it copying the actual C string characters, it literally just becomes a thin wrapper.

K.I.S.S.! If you can prove this approach is a problem by actual profiling, then OK, then you can talk about a more complex solution.

--Graham


_______________________________________________

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 C strings as keys
      • From: Jean-Daniel Dupas <email@hidden>
    • Re: NSMapTable with C strings as keys
      • From: Oleg Krupnov <email@hidden>
References: 
 >NSMapTable with C strings as keys (From: Oleg Krupnov <email@hidden>)

  • Prev by Date: Re: Nib image caching
  • Next by Date: Re: NSMapTable with C strings as keys
  • Previous by thread: Re: NSMapTable with C strings as keys
  • Next by thread: Re: NSMapTable with C strings as keys
  • Index(es):
    • Date
    • Thread