-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.cpp
More file actions
50 lines (44 loc) · 1.28 KB
/
Copy pathdebug.cpp
File metadata and controls
50 lines (44 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <bits/stdc++.h>
using namespace std;
void __debug_print(int x) {cerr << x;}
void __debug_print(long x) {cerr << x;}
void __debug_print(long long x) {cerr << x;}
void __debug_print(unsigned x) {cerr << x;}
void __debug_print(unsigned long x) {cerr << x;}
void __debug_print(unsigned long long x) {cerr << x;}
void __debug_print(float x) {cerr << x;}
void __debug_print(double x) {cerr << x;}
void __debug_print(long double x) {cerr << x;}
void __debug_print(char x) {cerr << '\'' << x << '\'';}
void __debug_print(const char *x) {cerr << '\"' << x << '\"';}
void __debug_print(const string &x) {cerr << '\"' << x << '\"';}
void __debug_print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __debug_print(const pair<T, V> &x) {
cerr << '{';
__debug_print(x.first);
cerr << ',';
__debug_print(x.second);
cerr << '}';
}
template<typename T>
void __debug_print(const T &x) {
int f = 0;
cerr << '{';
for (auto &i: x) {
cerr << (f++ ? ", " : "");
__debug_print(i);
}
cerr << "}";
}
void _debug_print() {
cerr << "]" << endl;
}
template <typename T, typename... V>
void _debug_print(T t, V... v) {
__debug_print(t);
if (sizeof...(v))
cerr << ", ";
_debug_print(v...);
}
#define debug(x...) cerr << "[" << #x << " = "; _debug_print(x);