• 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: Multidimensiaon Arrays in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multidimensiaon Arrays in Cocoa


  • Subject: Re: Multidimensiaon Arrays in Cocoa
  • From: "John C. Randolph" <email@hidden>
  • Date: Sun, 23 Sep 2001 08:58:56 -0700

On Sunday, September 23, 2001, at 06:26 AM, Ondra Cada wrote:

John,

John C. Randolph (JCR) wrote at Sun, 23 Sep 2001 05:52:41 -0700:
JCR> One trick that just occurred to me for storage of values of a sparse
JCR> array of any number of dimensions, is to keep the values in an
JCR> NSDictionary, where the key is the contatenation of the coordinates.

Actually, it is much cleaner to use an NSArray. Ie., instead of

// a contains the indices
[d setObject:value forKey:[a componentsJoinedByString:@":"]]

you would use directly

[d setObject:value forKey:a]

I don't think that would work, unless NSDictionary actually uses the value of [a description] for the key. I just tried making a few arrays in GDB, and all arrays with the same number of items returned the same value from -hash, no matter what the contents were.

-jcr


"I fear all we have done is to awaken a sleeping giant and fill him with a terrible resolve." -Admiral Isoroku Yamamoto, Dec 7, 1941.


References: 
 >Re: Multidimensiaon Arrays in Cocoa (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: What causes Finder 'Volume in use" alert?
  • Next by Date: OverLoad Constructor in multiple nibs (java-cocoa)
  • Previous by thread: Re: Multidimensiaon Arrays in Cocoa
  • Next by thread: What causes Finder 'Volume in use" alert?
  • Index(es):
    • Date
    • Thread