Re: STL vector not working
Re: STL vector not working
- Subject: Re: STL vector not working
- From: Todd Heberlein <email@hidden>
- Date: Fri, 11 Oct 2002 19:17:03 -0700
On Friday, October 11, 2002, at 04:27 PM, Arthur Clemens wrote:
@interface Database : NSObject
{
std::vector<int> _usedNumbersArray;
std::vector<int> _recycledNumbersArray;
}
C++ objects seem to need to be declared as pointers. Try the following
definitions instead:
std::vector<int> *_usedNumbersArray;
std::vector<int> *_recycledNumbersArray;
and then in an init method, do something like this:
- (id)init
{
if (self = [super init]) {
_usedNumbersArray = new std::vector<int>;
_recycledNumbersArray = new std::vector<int>;
...
}
return self;
}
Also, if you haven't done this already, make sure the implementation
file ends in .mm. [In Project Builder, right click on the file and
select Rename.]
Todd
_______________________________________________
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.