I have a vector I need to delete every third element
123456
12456
1245
125
15
1
vector<int>::iterator iter = v.begin();
while( iter != v.end() )
for( int i = 0; i < v.size() +2 ; i++ )
while( iter != v.end() )
{
if (v.size() != 1 ) )
iter = v.erase( iter );
else
++iter;
}
copy(v.begin(), v.end(), ostream_iterator<int>(cout, ""));
any suggestion it only gives the first two elements. Thanks in advance!