if all you want do is to remove item with value = 5, can’t this code suffice?
.
.
#include <algorithm>
std::remove_if ( vec.begin(), vec.end() , [](int i)
{
return ( i == 5 );
});
I do have a doubt though! does this sort of STL’s use impact runtime performance?