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: 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