Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <assert.h>
- #include <bits/stdc++.h>
- using namespace std;
- template <typename A> string to_string(vector<A> v)
- {
- bool first = true;
- string res = "[";
- for (const auto &x : v) {
- if (!first) {
- res += ",";
- }
- first = false;
- res += to_string(x);
- }
- res += "]";
- return res;
- }
- template <typename A, typename B> string to_string(pair<A, B> p)
- {
- return "(" + to_string(p.first) + "," + to_string(p.second) + ")";
- }
- template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p)
- {
- return "(" + to_string(get<0>(p)) + "," + to_string(get<1>(p)) + "," + to_string(get<2>(p)) + ")";
- }
- template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p)
- {
- return "(" + to_string(get<0>(p)) + "," + to_string(get<1>(p)) + "," + to_string(get<2>(p)) + "," +
- to_string(get<3>(p)) + ")";
- }
- void debug_out() { cerr << endl; }
- template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
- {
- cerr << to_string(H) << " ";
- debug_out(T...);
- }
- int main(int argc, char **argv)
- {
- pair<int, double> x{3, 5};
- vector<int> va{2, 3, 5};
- tuple<int, long, char> t3{2, (1ll << 50) - 51, 'z'};
- tuple<int, double, char, long> t4{0, 3e-5, 'b', 263};
- debug_out(x, va, t3, t4);
- /*
- debug_out(x);
- debug_out(va);
- debug_out(t3);
- debug_out(t4);
- */
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement