What I did..
And what I thought could work better but could not find a way, without using an invalid iterator.
for (auto temp :mybuffer)
<do something with temp>
mybuffer = newbuffer;
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 ?