fork download
  1. #include <iostream>
  2.  
  3. #include <set>
  4.  
  5. #include <vector>
  6.  
  7. using namespace std;
  8.  
  9. int
  10. main ()
  11. {
  12.  
  13. int mynumbers[] = { 8, 9, 7, 6, 4, 1 };
  14.  
  15. vector < int >v (mynumbers, mynumbers + 6);
  16.  
  17. set < int >s1 (v.begin (), v.end ());
  18.  
  19. s1.erase (s1.lower_bound (4), s1.upper_bound (9)); // LINE I
  20.  
  21. s1.insert (10); //LINE II
  22.  
  23. s1.insert (v.begin (), v.end ());
  24.  
  25. for (set < int >::iterator i = s1.begin (); i != s1.end (); i++)
  26.  
  27. cout << *i << ", ";
  28.  
  29. return 0;
  30.  
  31. }
  32.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
1, 4, 6, 7, 8, 9, 10,