SHARE
TWEET

Untitled

a guest Oct 21st, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>     // std::cout
  2. #include <algorithm>    // std::remove_if
  3. #include <set>
  4.  
  5. using namespace std;
  6.  
  7. int main () {
  8.  
  9.     set<int> numbers = {1,2,3,4,5,6};
  10.  
  11.     for(auto it = numbers.begin(); it != numbers.end();) {
  12.         if ((*it) > 2) {
  13.             numbers.erase(it);
  14.         } else {
  15.             ++it;
  16.         }
  17.     }
  18.  
  19.     return 0;
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top