Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <fstream>
- #include <math.h>
- #include <vector>
- #include <string>
- #include <sstream>
- #include <map>
- #include <set>
- using namespace std;
- template<typename First, typename Second>
- ostream& operator<<(ostream& out, const pair<First, Second>& p);
- template<typename Iter>
- string print_it(Iter it) {
- stringstream st;
- bool flag = true;
- for (auto& x : it) {
- if (!flag) {
- st << " ";
- }
- flag = false;
- st << x;
- }
- string s;
- getline(st, s);
- return s;
- }
- template<typename T>
- ostream& operator<<(ostream& out, const vector<T>& v) {
- out << "[ " << print_it(v) << " ]";
- return out;
- }
- template<typename First, typename Second>
- ostream& operator<<(ostream& out, const map<First, Second>& v) {
- out << "( " << print_it(v) << " )";
- return out;
- }
- template<typename First, typename Second>
- ostream& operator<<(ostream& out, const pair<First, Second>& p) {
- out << "{ " << p.first << "," << p.second << " }";
- return out;
- }
- template<typename T>
- T Min(T a, T b) {
- if (a < b) {
- return a;
- }
- return b;
- }
- template<typename First, typename Second>
- struct Pair{
- First first;
- Second second;
- };
- template<typename First, typename Second>
- ostream& operator<<(ostream& out, const Pair<First, Second>& p) {
- out << "{ " << p.first << "," << p.second << " }";
- return out;
- }
- int main() {
- #ifdef _DEBUG
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif //
- Pair<int, double> p;
- p.first = 3;
- p.second = 3.54;
- cout << p << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment