chang2394

C++ template

Oct 6th, 2014
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.38 KB | None | 0 0
  1. // uzumaki naruto
  2. #include <bits/stdc++.h>
  3. #define each(v,c)  for(typeof((c).begin()) v = (c).begin(); v != (c).end(); ++v)
  4. #define pb         push_back
  5. #define mp         make_pair
  6. #define sz(a)      ((int)(a.size()))
  7. #define all(a)     (a).begin(), (a).end()
  8. #define fi         first
  9. #define se         second
  10. #define TRACE
  11. using namespace std;
  12.  
  13. #ifdef TRACE
  14. #define debug(a,n)    cerr << "["; for(int i = 0; i < n; ++i) cerr << a[i] << " ";cerr << "\b]\n";
  15. #define dbg(args...)  {debug1,args; cerr<<endl;}
  16. #define pause()       cin.get();cin.get();
  17.  
  18. #else
  19.  
  20. #define debug(a,n)
  21. #define dbg(args...)
  22. #define pause()
  23.  
  24. #endif
  25.  
  26. struct debugger {
  27.     template<typename T> debugger& operator , (const T& v) {
  28.         cerr<<v<<" "; return *this;
  29.     }
  30. } debug1;
  31.  
  32. template <typename T1, typename T2>
  33. inline ostream& operator << (ostream& os, const pair<T1, T2>& p) {
  34.     return os << "(" << p.first << ", " << p.second << ")";
  35. }
  36.  
  37. template<typename T>
  38. inline ostream &operator << (ostream & os,const vector<T>& v) {
  39.     bool first = true; os << "[";
  40.     for (typename vector<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii) {
  41.         if(!first) os << ", ";
  42.         os << *ii; first = false;
  43.     }
  44.     return os << "]";
  45. }
  46.  
  47. typedef long long LL;
  48. typedef pair<int,int> pii;
  49. typedef vector<int> vi;
  50.  
  51. int main()
  52. {
  53.     ios_base::sync_with_stdio(0);
  54.     return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment