• 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: Maintaining a List of instances of a class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Maintaining a List of instances of a class


  • Subject: Re: Maintaining a List of instances of a class
  • From: Stefan Heukamp <email@hidden>
  • Date: Wed, 18 Jul 2007 19:02:43 +0200

how do I let a class maintain a list (MutableArray) of it's own instances?
In C++ I would do this just in the constructor.
You can try with - (id)init, the nearest thing you have to a
constructor: something like

	It's better implementing this in Objective C++.
And declare:
	static std::set<id> instanceList;

This sounds good. For some other reasons I'd like using c++. I think an stl
vector is (because of its binding at compiletime) faster than an NSMutableArray.
Am I right with this point? I need this speed in another project where I up to
now used c-arrays to implement an R-Tree. That was pretty ugly.


But unfortunately I didn't get it working. #import <set> and #include <set> gave
me compiler errors. How do I declare a file being Objective-C++? I tried renaming
it simply to *.mm but that didn't work. The project is a Cocoa Application.


Thanks for any comments so far,

Stefan
_______________________________________________

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: Maintaining a List of instances of a class
      • From: John Stiles <email@hidden>
References: 
 >Re: Maintaining a List of instances of a class (From: "Paolo Manna" <email@hidden>)
 >Re: Maintaining a List of instances of a class (From: Tommy Nordgren <email@hidden>)

  • Prev by Date: Re: NSScreen + resolution change
  • Next by Date: Re: Maintaining a List of instances of a class
  • Previous by thread: Re: Maintaining a List of instances of a class
  • Next by thread: Re: Maintaining a List of instances of a class
  • Index(es):
    • Date
    • Thread