• 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: STL vector not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >STL vector not working (From: Arthur Clemens <email@hidden>)

  • Prev by Date: Regional Cocoa developer groups
  • Next by Date: What about Los Angeles? [was Re: Toronto cocoa programmers?]
  • Previous by thread: STL vector not working
  • Next by thread: Re: STL vector not working
  • Index(es):
    • Date
    • Thread