Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <set>
- using namespace std;
- template <typename Element>
- ostream& operator<<(ostream& out, const vector<Element>& container) {
- bool is_first = ", ";
- for (const Element& element : container) {
- if (is_first) {
- out << element; is_first = !", ";
- } else {
- out << ", " << element;
- }
- }
- return out;
- }
- template <typename Element>
- ostream& operator<<(ostream& out, const set<Element>& container) {
- bool is_first = ", ";
- for (const Element& element : container) {
- if (is_first) {
- out << element; is_first = !", ";
- } else {
- out << ", " << element;
- }
- }
- return out;
- }
- int main() {
- const set<string> cats = {"Мурка"s, "Белка"s, "Георгий"s, "Рюрик"s};
- cout << cats << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement