Created
October 18, 2013 15:01
-
-
Save ashashwat/7042885 to your computer and use it in GitHub Desktop.
Temple.cpp diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /Volumes/CoreHD/Codes/topcoder-greed/src/main/resources/Resource/Template.cpp 2013-08-15 23:27:44.000000000 +0530 | |
+++ Template.cpp 2013-08-15 15:07:42.000000000 +0530 | |
@@ -1,23 +1,125 @@ | |
-#include <cstdio> | |
+${CutBegin} | |
+// {{{ Headers | |
+// vim:filetype=cpp:foldmethod=marker:foldmarker={{{,}}} | |
+${CutEnd} | |
+ | |
+#include <cassert> | |
+#include <cctype> | |
#include <cmath> | |
+#include <climits> | |
+#include <cstdio> | |
+#include <cstdlib> | |
#include <cstring> | |
#include <ctime> | |
-#include <iostream> | |
+ | |
#include <algorithm> | |
+#include <deque> | |
+#include <functional> | |
+#include <iterator> | |
+#include <list> | |
+#include <map> | |
+#include <numeric> | |
+#include <queue> | |
#include <set> | |
+#include <stack> | |
+#include <string> | |
+#include <utility> | |
#include <vector> | |
+ | |
+#include <fstream> | |
+#include <iostream> | |
#include <sstream> | |
-#include <typeinfo> | |
+ | |
+#include <ext/numeric> | |
using namespace std; | |
+using namespace __gnu_cxx; | |
+${CutBegin} | |
+// }}} | |
+${CutEnd} | |
+ | |
+typedef long long int64; | |
+ | |
+const int INF = 0x3f3f3f3f; | |
+ | |
+template <class T> int len (T a) { return a.size (); } | |
+${CutBegin} | |
+// {{{ Unused templates and debug | |
+// Overloading ostream for printing STL containers (pair, vector, set, map) | |
+template <typename T1, typename T2> | |
+inline std::ostream &operator << (std::ostream &os, const std::pair <T1, T2> &p) { | |
+ return os << "(" << p.first << ", " << p.second << ")"; | |
+} | |
+template <typename T> | |
+inline std::ostream &operator << (std::ostream &os, const std::vector <T> &v) { | |
+ bool first = true; | |
+ os << "["; | |
+ for (unsigned int i = 0; i < v.size(); i++) { | |
+ if (! first) | |
+ os << ", "; | |
+ os << v[i]; | |
+ first = false; | |
+ } | |
+ return os << "]"; | |
+} | |
+template <typename T> | |
+inline std::ostream &operator << (std::ostream &os, const std::set <T> &S) { | |
+ bool first = true; | |
+ os << "set(["; | |
+ for (typename std::set <T>::const_iterator it = S.begin(); it != S.end(); ++it) { | |
+ if (! first) | |
+ os << ", "; | |
+ os << *it; | |
+ first = false; | |
+ } | |
+ return os << "])"; | |
+} | |
+template <typename T1, typename T2> | |
+inline std::ostream &operator << (std::ostream &os, const std::map <T1, T2> &d) { | |
+ bool first = true; | |
+ os << "{"; | |
+ for (typename std::map<T1, T2>::const_iterator it = d.begin(); it != d.end(); ++it) { | |
+ if (! first) | |
+ os << ", "; | |
+ os << it->first << ": " << it->second; | |
+ first = false; | |
+ } | |
+ return os << "}"; | |
+} | |
+ | |
+// debug () can print vector, set, map, pairs etc now. | |
+#define debug(args...) { cerr << " #--> "; dbg, args; cerr << endl; } | |
+struct debugger { | |
+ template <typename T> debugger& operator, (const T v) { | |
+ cerr << v << " "; | |
+ return *this; | |
+ } | |
+} dbg; | |
+ | |
+// }}} | |
+${CutEnd} | |
class ${ClassName} { | |
public: | |
- ${Method.ReturnType} ${Method.Name}(${Method.Params}) { | |
+ ${Method.ReturnType} | |
+ ${Method.Name}(${Method.Params}) { | |
return ${Method.ReturnType;ZeroValue}; | |
} | |
}; | |
${CutBegin} | |
+// {{{ Test Code | |
${<TestCode} | |
+// }}} | |
${CutEnd} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment