• 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: Where is NSList?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where is NSList?


  • Subject: Re: Where is NSList?
  • From: Tim Conkling <email@hidden>
  • Date: Wed, 28 Jul 2004 15:43:56 -0400

Sorry, I mispoke when I said that NSMutableDictionary provides the functionality I'm looking for. I need a collection that can be ordered, which rules out NSMutableDictionary and NSSet. Really, truly, I promise, a list is what I am looking for. The fact that it doesn't exist in Cocoa is cool; I'll do something else.

Tim

On Jul 28, 2004, at 1:56 PM, Allan Odgaard wrote:

On 28. Jul 2004, at 14:45, Tim Conkling wrote:

As much as I hate to continue this...

Hopefully I won't add further to your frustration ;)

Pandaa put it well. It's not about the semantics. It's about the implementation. Neither NSArray nor NSMutableDictionary provide the time complexities that I am looking for, though they _do_ provide all the _functionality_ I'm looking for.

NSDictionary (and more appropriate for what I think you need, NSSet) do sort of say that they are O(1) for insertions or removals -- that is, I think they say expected O(1) and worst case O(lg n) (though the CFSet/CFDictionary documentation, not the Cocoa documentation).

If your problem were, that you had one object in multiple "containers" and when deleting the object, you wanted to remove it from all of these "containers" (w/o having to do linear search in each), I think NSSet is exactly what you need. You'll also not have to let each object keep iterators to all the sets.

If you do prefer the list, notice that you can do:
std::list<MyClass*> list_of_my_objects;

Or, if you want it to retain/release properly, use a smart-pointer:
std::list< objc_ptr<MyClass*> > list_of_my_objects;
_______________________________________________
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: Where is NSList?
      • From: Greg Hulands <email@hidden>
References: 
 >Re: Where is NSList? (From: Theodore Petrosky <email@hidden>)
 >Re: Where is NSList? (From: Tim Conkling <email@hidden>)
 >Re: Where is NSList? (From: Allan Odgaard <email@hidden>)

  • Prev by Date: Re: Where is NSList?
  • Next by Date: Re: Bug database or known issues
  • Previous by thread: Re: Where is NSList?
  • Next by thread: Re: Where is NSList?
  • Index(es):
    • Date
    • Thread