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 type>
- void Print(ostream& out, const type& kunteynir){
- bool first_ap = true;
- for(const auto& kun: kunteynir){
- if(!first_ap){
- out << ", ";
- }
- first_ap = false;
- out << kun;
- }
- }
- template<typename type>
- ostream& operator<< (ostream& out, const set<type>kunteynir){
- out << "{";
- Print(out, kunteynir);
- out << "}";
- return out;
- }
- template<typename type>
- ostream& operator<< (ostream& out, const vector<type>kunteynir){
- out << "[";
- Print(out, kunteynir);
- out << "]";
- return out;
- }
- int main() {
- const vector<int> ages = {10, 5, 2, 12};
- const set<int> set_ages = {20, 15, 3 , 1};
- cout << ages << endl;
- cout << set_ages << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement