Re: Maintaining a List of instances of a class
Re: Maintaining a List of instances of a class
- Subject: Re: Maintaining a List of instances of a class
- From: John Stiles <email@hidden>
- Date: Wed, 18 Jul 2007 10:15:24 -0700
Renaming to .mm and then doing #include <set> should be sufficient.
I've used that in my own projects without any issues. What kind of
errors were they?
On Jul 18, 2007, at 10:02 AM, Stefan Heukamp wrote:
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:
40blizzard.com
This email sent to email@hidden
_______________________________________________
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