Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef const std::unordered_set<short> set_t;
- set_t some_set = {1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36};
- typedef const std::unordered_set<short> set_t;
- set_t some_set = {1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36};
- #include <iostream>
- #include <unordered_set>
- int main() {
- typedef const std::unordered_set<short> set_t;
- set_t some_set = {1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36};
- for (short s : some_set)
- std::cout << s << std::endl;
- // The order won't change if we don't modify the contents
- std::cout << "AGAIN!" << std::endl;
- for (short s : some_set)
- std::cout << s << std::endl;
- // If we put a bunch of stuff in
- for (short s = 31; s < 100; s += 4)
- some_set.insert(s);
- // The elements from *before* the modification are not necessarily in the
- // same order as before.
- std::cout << "MODIFIED" << std::endl;
- for (short s : some_set)
- std::cout << s << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement