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 #include<fstream>
23 
24 #include <assert.h>
25 
26 typedef unsigned int uint;
27 
28 class InvalidQuery {
29 
30 public:
31 
32  InvalidQuery(std::string error_msg) {
33  std::cerr << "Invalid Query: " << error_msg << "\n";
34  }
35 
36 };
37 
38 template<class T>
39 std::ostream& operator <<(std::ostream& os, const typename std::vector<T>& v) {
40  for (typename std::vector<T>::const_iterator ii = v.begin(); ii != v.end();
41  ++ii) {
42  os << " " << *ii;
43  }
44  os << "\n";
45 
46  return os;
47 }
48 
49 template<class T>
50 std::ostream& operator <<(std::ostream& os,
51  const typename std::vector<std::pair<T, T> >& v) {
52  for (typename std::vector<std::pair<T, T> >::const_iterator ii = v.begin();
53  ii != v.end(); ++ii) {
54  os << "(" << *ii->first << " , " << *ii->second << ") ";
55  }
56  os << "\n";
57  return os;
58 }
59 
60 #endif
Definition: utils.h:28