Guest User

Untitled

a guest
Jan 18th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. void SomeFunction()
  2. {
  3. std::list<Something> list;
  4. std::list<Something>::iterator it1;
  5. std::list<Something>::iterator it2;
  6.  
  7. for (it1 = list.begin(); it1 != list.end(); it1++)
  8. {
  9. for (it2 = list.begin(); it2!=list.end(); it2++)
  10. {
  11. if (it1->SomeValue() == it2->SomeValue())
  12. {
  13. if (it1 != it2)
  14. {
  15. list.erase(it1);
  16. list.erase(it2);
  17.  
  18. it2 = list.begin();
  19. it1 = it2++;
  20. }
  21. }
  22. }
  23. }
  24. }
Add Comment
Please, Sign In to add comment