Max Frai
Max Frai

Reputation: 64276

Iterating through boost ptr_vector

I have a ptr_vector list of my own objects. Something like this:

boost::ptr_vector<SomeClass> *list;
list->push_back(new SomeClass()>;
...
BOOST_FOREACH(SomeClass *tempObj, list)   // [x]
{
   tempObj->...
}


>‘boost::ptr_vector<SomeClass>*’ is not a class, struct, or union type

Upvotes: 0

Views: 575

Answers (1)

Timo Geusch
Timo Geusch

Reputation: 24351

I think your problem is that you declared 'list' as a pointer to a boost::ptr_vector and are trying to use it as an automatic object.

IMHO the first line of your code snippet should read:

boost::ptr_vector<SomeClass> list;

Upvotes: 5

Related Questions