Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <set>
- using namespace std;
- void PrintSet(const set <string>& s)
- {
- cout << "Size = " << s.size() << endl;
- for (auto x : s) // перестали копировать очередную пару ключ - значение в переменную item c помощью константной ссылки
- {
- cout << x << endl;
- }
- }
- int main()
- {
- set<string> famous_persons;
- famous_persons.insert("Stroustrup");
- famous_persons.insert("Ritchie");
- famous_persons.insert("Anton");
- PrintSet(famous_persons);
- famous_persons.erase("Anton");
- PrintSet(famous_persons);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement