• 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: A Matrix collection class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A Matrix collection class


  • Subject: Re: A Matrix collection class
  • From: Chris Purcell <email@hidden>
  • Date: Wed, 8 May 2002 07:44:35 +0100

The problem with that approach is that it gets very memory and time inefficient if you have several dimensions - need to set up an awful lot of NSArrays. I was hoping for something a little less ugly.

Kritter out

Chris Purcell wrote:
|Does anyone know of a good implementation of a matrix collection class -
|a multi-dimensional array class without the overheads of NSDictionary?

Would an array of arrays (technically, an NSArray containing NSArrays) work? (I don't think I'd even consider NSDictionary to implement a matrix, unless maybe you want a sparse matrix.) You could wrap it in its own class to hide the ugliness. For example:

- (id) objectAtRow: (int) r column: (int) c
{
return [[iMatrix objectAtIndex: r] objectAtIndex: c];
}

Glen Fisher
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: A Matrix collection class
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Making an NSTextView have a data source
  • Next by Date: NSQuickDrawView update problem
  • Previous by thread: Re: A Matrix collection class
  • Next by thread: Re: A Matrix collection class
  • Index(es):
    • Date
    • Thread