pushing back an boost::ptr_vector<...>::iterator in another boost::ptr_vector?

Posted by Ethan Nash on Stack Overflow See other posts from Stack Overflow or by Ethan Nash
Published on 2010-03-22T16:12:52Z Indexed on 2010/03/22 16:31 UTC
Read the original article Hit count: 403

Filed under:
|
|
|

Hi all,

I have the following code (just typed it in here, might have typos or stuff):

typedef boost::ptr_vector<SomeClass> tvec;
tvec v;

// ... fill v ...

tvec vsnap;

for(tvec::iterator it = v.begin(); it != v.end(); ++it)
{
   if((*v).anyCondition)
       vsnap.push_back( it ); // (*it) or &(*it) doesn't work
}

My problem is now that i cant push_back an iterator in any way, I just don't get the pointer out of the iterator.

Is there an easy way i didnt see, or are boosts ptr_vector the false choice for this case?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about boost

Related posts about ptr-vector