What I did..
Code:
for (auto temp :mybuffer)
{
if(some_condition)
<do something with temp>
else
newbuffer.push_back(temp)
}
mybuffer = newbuffer;
And what I thought could work better but could not find a way, without using an invalid iterator.
1.Iterate through the extent of the original size of 'mybuffer'
2.instead of pushing the temp 's which do not satisfy some_condition into a new buffer, push them on the back of my_buffer itself .
Are the two ways essentially same, or is the later better(In that case, suggest an elegant way of doing so)?
Or is there a process even better ?