Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. map<string, int> myMap;
  2. myMap["one"] = 1;
  3. myMap["two"] = 2;
  4. myMap["three"] = 3;
  5.  
  6. map<string, int>::iterator it = myMap.find("two");
  7.  
  8. myMap.erase( it, myMap.end() );
  9.  
  10. myMap.erase( myMap.end() );
  11.  
  12. myMap.erase( myMap.end(), myMap.end() );
  13.  
  14. if ( it != myMap.end() )
  15. myMap.erase( it );
  16.  
  17. map<int,int> m;
  18. for (int i = 0; i < 5; ++i)
  19. m[i] = i;
  20. m.erase( m.find(1), m.find(4) );
  21.  
  22. for (int i = 1; i <= 4; ++i )
  23. m.erase( m.find(i) );
  24.  
  25. a.erase( q1, q2)
  26.  
  27. a.erase(q)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement