Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void SomeFunction()
- {
- std::list<Something> list;
- std::list<Something>::iterator it1;
- std::list<Something>::iterator it2;
- for (it1 = list.begin(); it1 != list.end(); it1++)
- {
- for (it2 = list.begin(); it2!=list.end(); it2++)
- {
- if (it1->SomeValue() == it2->SomeValue())
- {
- if (it1 != it2)
- {
- list.erase(it1);
- list.erase(it2);
- it2 = list.begin();
- it1 = it2++;
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment