Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. typedef const std::unordered_set<short> set_t;
  2. set_t some_set = {1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36};
  3.  
  4. typedef const std::unordered_set<short> set_t;
  5. set_t some_set = {1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36};
  6.  
  7. #include <iostream>
  8. #include <unordered_set>
  9.  
  10. int main() {
  11. typedef const std::unordered_set<short> set_t;
  12. set_t some_set = {1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36};
  13.  
  14. for (short s : some_set)
  15. std::cout << s << std::endl;
  16.  
  17. // The order won't change if we don't modify the contents
  18. std::cout << "AGAIN!" << std::endl;
  19. for (short s : some_set)
  20. std::cout << s << std::endl;
  21.  
  22. // If we put a bunch of stuff in
  23. for (short s = 31; s < 100; s += 4)
  24. some_set.insert(s);
  25.  
  26. // The elements from *before* the modification are not necessarily in the
  27. // same order as before.
  28. std::cout << "MODIFIED" << std::endl;
  29. for (short s : some_set)
  30. std::cout << s << std::endl;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement