2012-01-22 14:52:31 +01:00
|
|
|
#include <vector>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
std::vector<int> items;
|
|
|
|
items.push_back(1);
|
|
|
|
items.push_back(2);
|
|
|
|
items.push_back(3);
|
|
|
|
std::vector<int>::iterator iter;
|
2012-09-26 16:10:28 +02:00
|
|
|
for (iter = items.begin(); iter != items.end();) {
|
2017-09-08 14:25:08 +02:00
|
|
|
if (*iter == 2) {
|
2012-01-22 14:52:31 +01:00
|
|
|
iter = items.erase(iter);
|
|
|
|
} else {
|
|
|
|
++iter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|