My Project
Utils.h
1 #ifndef UTILS_H
2 #define UTILS_H
3 
4 #include<cstdio>
5 #include<cstdlib>
6 #include<cstring>
7 
8 /*
9  STL
10  */
11 
12 #include<map>
13 #include<set>
14 #include<stack>
15 #include<string>
16 #include<vector>
17 #include<bitset>
18 #include<algorithm>
19 
20 #include<sstream>
21 #include<iostream>
22 
23 typedef unsigned int uint;
24 
25 class InvalidQuery {
26 
27 public:
28 
29  InvalidQuery(std::string error_msg) {
30  std::cerr << "Invalid Query: " << error_msg << "\n";
31  }
32 
33 };
34 
35 template<class T>
36 std::ostream& operator <<(std::ostream& os, const typename std::vector<T>& v) {
37  for (typename std::vector<T>::const_iterator ii = v.begin(); ii != v.end();
38  ++ii) {
39  os << " " << *ii;
40  }
41  os << "\n";
42 
43  return os;
44 }
45 
46 template<class T>
47 std::ostream& operator <<(std::ostream& os,
48  const typename std::vector<std::pair<T, T> >& v) {
49  for (typename std::vector<std::pair<T, T> >::const_iterator ii = v.begin();
50  ii != v.end(); ++ii) {
51  os << "(" << *ii->first << " , " << *ii->second << ") ";
52  }
53  os << "\n";
54  return os;
55 }
56 
57 #endif
Definition: Utils.h:25